How to solve NullPointerException: null keys are not permitted error using Configuration Manager for Jira

Problem

The deployment failed with the NullPointerException: null keys are not permitted error

Error Message

{"timestamp":"2023-03-2023","level":"ERROR","serviceId":null,"product":null,"hostname":"xxxxxxx","env":null,"pid":12345,"thread":"http-nio-8080-exec-36 url: /rest/configuration-manager/1.0/deployment/10/conflicts/analysis; user: abc@atlassian.com","logger":"com.botronsoft.jira.rollout.impl.rest.AbstractResource","message": "java.lang.NullPointerException: null keys are not permitted","err":{"msg":"java.lang.NullPointerException: null keys are not permitted","stack":"com.atlassian.cache.CacheException: java.lang.NullPointerException: null keys are not permitted\n\tat com.atlassian.cache.ehcache.DelegatingCache.get(DelegatingCache.java:117)\n\tat com.atlassian.jira.issue.fields. layout.field.DefaultFieldLayoutManager.getFieldConfigurationScheme(DefaultFieldLayoutManager.java:544)\n\tat

 Solution

This can be solved using below steps:

  1. Bring down the Jira Instance.

  2. Shut down the database.

  3. Execute the following queries which will identify rows in this state:

    select * from fieldlayoutschemeentity where fieldlayout is null; select * from fieldlayoutschemeentity where fieldlayout not in (select id from fieldlayout);
  4. The expectation is that no results are returned, as all entries should have a value in here. If something is returned, then it's a bad reference.

  5. Perform the DELETE action as below:

    delete from fieldlayoutschemeentity where fieldlayout is null; delete from from fieldlayoutschemeentity where fieldlayout not in (select id from fieldlayout);
  6. The rows identified above should be deleted by the primary key identifier.

  7. If nothing is returned from the previous query, just create a new screen scheme and associate it with the project.

The tables may differ and the columns may differ but the solution is the same. Here the tables are fieldlayoutschemeentity and fieldlayout.

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.