Jira server throws NullPointerException when creating new issues or changing project settings
症状
Trying to create a new issue or modify administer a project results in the following a stacktrace in atlassian-jira.log
:
2012-06-16 17:34:55,886 TP-Processor9 ERROR [500ErrorPage.jsp] Exception caught in 500 page null
java.lang.NullPointerException
at com.atlassian.jira.issue.fields.IssueTypeSystemField.populateOptionsForProjects(IssueTypeSystemField.java:146)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.getCreateHtml(IssueTypeSystemField.java:118)
at com.atlassian.jira.quickedit.rest.api.field.QuickFieldsFactoryImpl.createProjectAndIssueTypeFields(QuickFieldsFactoryImpl.java:188)
at com.atlassian.jira.quickedit.rest.api.field.QuickFieldsFactoryImpl.getCreateFields(QuickFieldsFactoryImpl.java:57)
at com.atlassian.jira.quickedit.action.QuickCreateIssue.doDefault(QuickCreateIssue.java:178)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
または
java.lang.NullPointerException
at com.atlassian.jira.issue.fields.config.manager.IssueTypeSchemeManagerImpl.getIssueTypesForConfigScheme(IssueTypeSchemeManagerImpl.java:292)
at com.atlassian.jira.issue.fields.config.manager.IssueTypeSchemeManagerImpl.getSubTaskIssueTypesForProject(IssueTypeSchemeManagerImpl.java:286)
at sun.reflect.GeneratedMethodAccessor2292.invoke(Unknown Source)
Trying to move issues results in the following a stacktrace in atlassian-jira.log
:
2014-07-18 12:16:42,059 catalina-ssl-exec-558 ERROR admin 736x2315550x13 1vp48y6 10.111.96.134 /secure/MoveIssue.jspa [jira.plugin.actions.Move
Ext] Exception: com.atlassian.jira.util.dbc.Assertions$NullArgumentException: config should not be null!
com.atlassian.jira.util.dbc.Assertions$NullArgumentException: config should not be null!
at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:28)
at com.atlassian.jira.issue.fields.option.CachedOptionSetManager.getOptionsForConfig(CachedOptionSetManager.java:50)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.getOptionsForConfig(IssueTypeSystemField.java:633)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.getOptionsForConfig(IssueTypeSystemField.java:628)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.getOptionsForIssue(IssueTypeSystemField.java:623)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.validateParams(IssueTypeSystemField.java:378)
at com.atlassian.jira.web.action.issue.MoveIssue.doValidation(MoveIssue.java:171)
at webwork.action.ActionSupport.validate(ActionSupport.java:391)
at webwork.action.ActionSupport.execute(ActionSupport.java:162)
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82)
at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39)
at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31)
原因
- JIRA's Default Issue Type Scheme has somehow become corrupted in the database. The root cause for this is still unknown.
- Third-party add-on causing this NPE
Diagnosis and Resolution
Run all the suggested SQL Checks and Resolutions in order to solve the problem.
Check 1:
SELECT * FROM fieldconfiguration WHERE id IN (SELECT id FROM fieldconfigscheme WHERE configname='Default Issue Type Scheme') AND fieldid = 'issuetype';
This should always return 1 row, meaning that there is a "Default Issue Type Scheme" and "Default Configuration for Issue Type" with the same id.
If this returns no rows, additional modifications must be done to the database than the ones mentioned on this documentation.
Resolution 1:
Contact Support as this documentation does not apply and the fix requires personalized assistance.
Do not continue with additional checks.
Check 2:
SELECT * FROM configurationcontext WHERE customfield = 'issuetype' AND project IS NULL AND fieldconfigscheme = (SELECT id FROM fieldconfigscheme WHERE configname='Default Issue Type Scheme');
If it returns no rows, then this article is applicable as it indicates the default association is not present.
Resolution 2:
データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。
INSERT INTO configurationcontext VALUES ((SELECT MAX(id)+1 FROM configurationcontext),NULL,NULL,'issuetype',(SELECT id FROM fieldconfigscheme WHERE configname='Default Issue Type Scheme'));
Continue with Check 3
Check 3:
SELECT * FROM fieldconfigschemeissuetype WHERE id = 10100 OR fieldconfigscheme IN (SELECT id FROM fieldconfiguration WHERE id IN (SELECT id FROM fieldconfigscheme where configname='Default Issue Type Scheme'));
If this returns no rows, then this article is applicable as it indicates there is no link between the "Default Issue Type Scheme" and "Default Configuration for Issue Type".
Resolution 3:
データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。
INSERT INTO fieldconfigschemeissuetype VALUES (10100,null,(SELECT id FROM fieldconfiguration WHERE id IN (SELECT id FROM fieldconfigscheme WHERE configname='Default Issue Type Scheme') AND fieldid = 'issuetype'),(SELECT id FROM fieldconfiguration WHERE id IN (SELECT id FROM fieldconfigscheme WHERE configname='Default Issue Type Scheme') AND fieldid = 'issuetype'));
JIRA must be restarted for caches to be recreated with the modified data.
Check 4:
If queries above return results as expected, need to check error stack trace, as this might be triggered by a third-party add-on.
p.e.:
http-nio-8080-exec-183 ERROR [o.a.c.c.C.[.[localhost].[/].[action]] Servlet.service() for servlet [action] in context with path [] threw exception [java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at com.atlassian.jira.issue.fields.IssueTypeSystemField.populateOptionsForProjects(IssueTypeSystemField.java:166)
at com.atlassian.jira.issue.fields.IssueTypeSystemField.getCreateHtml(IssueTypeSystemField.java:140)
at com.atlassian.jira.issue.fields.rest.FieldHtmlFactoryImpl.createField(FieldHtmlFactoryImpl.java:116)
..
....
at com.develocenter.jira.extschemes.web.filter.DisableNewEntitiesFilter.doFilter(DisableNewEntitiesFilter.java:55)
... 3 filtered
at com.develocenter.jira.extschemes.web.filter.JIRALinkFilter.doFilter(JIRALinkFilter.java:70)
... 36 filtered
In this case, the add-on "Extended Schemes for JIRA" from "Develocenter" vendor was causing the issue, after disabling the add-on, issue creation is working as expected.
Resolution 4:
Disable the add-on, if the issue is gone after disabling it, contact the add-on vendor for further information.