Unable to View Screens in Project Administration Due to java.lang.NullPointerException
Symptoms
After an upgrade, clicking the Screens Tab under Administration >> Projects for every project will cause the stack trace below:
java.lang.NullPointerException at com.atlassian.jira.issue.fields.screen.issuetype.DefaultProjectIssueTypeScreenSchemeHelper.getProjectsForFieldScreenSchemes(DefaultProjectIssueTypeScreenSchemeHelper.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Clicking on the affected project via Administration >> Issues >> Screens >> Issue Type Screen Schemes will caused another stack trace:
java.lang.NullPointerException at com.atlassian.jira.projectconfig.contextproviders.ScreensSummaryPanelContextProvider.getScreenSchemes(ScreensSummaryPanelContextProvider.java:75) at com.atlassian.jira.projectconfig.contextproviders.ScreensSummaryPanelContextProvider.getContextMap(ScreensSummaryPanelContextProvider.java:62) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.initContextMap(CacheableContextProviderDecorator.java:70) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.getContextMap(CacheableContextProviderDecorator.java:46)
Accessing a specific few projects result in:
java.lang.NullPointerException at com.atlassian.jira.projectconfig.contextproviders.ScreensSummaryPanelContextProvider$SimpleIssueTypeScreenScheme.<init>(ScreensSummaryPanelContextProvider.java:217) at com.atlassian.jira.projectconfig.contextproviders.ScreensSummaryPanelContextProvider.getContextMap(ScreensSummaryPanelContextProvider.java:59) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.initContextMap(CacheableContextProviderDecorator.java:70) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.getContextMap(CacheableContextProviderDecorator.java:46)
- As a secondary effect, it's possible that some projects cannot be deleted. See Unable to Delete a Project due to java.lang.NullPointerException to correct these.
Cause
The project has no Issue Type Screen Scheme associated . This is reproducible as described in - JRA-26570Getting issue details... STATUS . While the primary reasons for that bug is corrected, there are chances that this error can happen in later versions of JIRA as explained at - JRA-27324Getting issue details... STATUS .
Workaround
METHOD 1: For projects that do not contain data and is no longer needed
Locate the problematic projects:
SELECT * FROM project WHERE id NOT IN (SELECT source_node_id FROM nodeassociation WHERE sink_node_entity = 'IssueTypeScreenScheme');
- Delete the problematic project(s) that were the result of step 1. Note that you may experience a secondary NullPointerException, in which case, follow the instructions in Unable to Delete a Project due to java.lang.NullPointerException.
METHOD 2: For projects that contain data
Locate the Issue Type Screen association with query below:
SELECT id from project where id not in (select source_node_id from nodeassociation where sink_node_entity = 'IssueTypeScreenScheme');
Note the results, they'll be used below.
For each id gathered above, insert a dummy Issue Type Screen Scheme into the database:
INSERT into nodeassociation VALUES ('<id from above>','Project',1,'IssueTypeScreenScheme','ProjectScheme',NULL);
- Visit the project page. You should be able to access the culprit project, and all the Screens pages from project administration.
METHOD 3: Only try this when method 2 is not working
If the user is still unable to access the project even after the INSERT query has been executed, update the nodeassociation with this query :
UPDATE nodeassociation set SINK_NODE_ID=<ID of scheme> where SOURCE_NODE_ID=<id of project> and SINK_NODE_ENTITY='IssueTypeScreenScheme';
- Restart JIRA.
- Visit the project page. You should be able to access the culprit project, and all the Screens pages from project administration.
Resolution
Upgrade to JIRA 5.0.1. See - JRA-26570Getting issue details... STATUS .