NullPointerException when creating, editing, moving issue, accessing the Screen tab from the Project
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
A NullPointerException is generated when creating, editing, accessing the Screen tab from the Project. The following appears in the atlassian-jira.log
:
2012-07-18 09:18:32,314 http-8080-7 ERROR [500ErrorPage.jsp] Exception caught in 500 page null
java.lang.NullPointerException
at com.atlassian.jira.issue.fields.option.IssueConstantOption.getId(IssueConstantOption.java:48)
at com.atlassian.jira.issue.fields.config.manager.IssueTypeSchemeManagerImpl.getIssueTypesForConfigScheme(IssueTypeSchemeManagerImpl.java:283)
at com.atlassian.jira.issue.fields.config.manager.IssueTypeSchemeManagerImpl.getSubTaskIssueTypesForProject(IssueTypeSchemeManagerImpl.java:270)
Also, when accessing the Screens or Fields tab of Project Administration in JIRA versions 6.3.x or later the following may occur in the logs:
2015-06-18 16:51:11,966 http-bio-443-exec-135 WARN xxxxxx 1011x36381x2 78rwf7 xxx.xxx.xxx.xxx /plugins/servlet/project-config/JIRA/fields[com.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'java.lang.NullPointerException - null'.
or
2015-06-18 16:51:11,966 http-bio-443-exec-135 WARN xxxxxx 1011x36381x2 78rwf7 xxx.xxx.xxx.xxx /plugins/servlet/project-config/JIRA/screens[com.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'java.lang.NullPointerException - null'.
Cause
At any given time, there was an exception while deleting an issue type, but before the entry from the optionconfiguration
table was deleted, an exception was thrown.
There is a bug raised for this under JRASERVER-45161 - Deleting an Issue Type can result in a NullPointerException when attempting to perform a number of actions within JIRA.
Diagnosis
We are looking for a row where the optionid
column has a value that does not match an ID
on the issuetype
table. For example:
mysql> select * from optionconfiguration;
+-------+-----------+----------+-------------+----------+
| ID | FIELDID | OPTIONID | FIELDCONFIG | SEQUENCE |
+-------+-----------+----------+-------------+----------+
| 10363 | issuetype | 2 | 10200 | 0 |
| 10364 | issuetype | 4 | 10200 | 1 |
| 10365 | issuetype | 7 | 10200 | 2 |
| 10366 | issuetype | 8 | 10200 | 3 |
| 10367 | issuetype | 9 | 10200 | 4 |
| 10368 | issuetype | 3 | 10200 | 5 |
| 10369 | issuetype | 5 | 10200 | 6 |
| 10567 | issuetype | 15 | 10300 | 0 |
| 10600 | issuetype | 1 | 10000 | 0 |
| 10601 | issuetype | 2 | 10000 | 1 |
| 10602 | issuetype | 3 | 10000 | 2 |
| 10603 | issuetype | 4 | 10000 | 3 |
| 10604 | issuetype | 5 | 10000 | 4 |
| 10605 | issuetype | 6 | 10000 | 5 |
| 10606 | issuetype | 7 | 10000 | 6 |
| 10607 | issuetype | 8 | 10000 | 7 |
| 10608 | issuetype | 9 | 10000 | 8 |
| 10609 | issuetype | 11 | 10000 | 9 |
| 10610 | issuetype | 1 | 10000 | 10 |
| 10611 | issuetype | 15 | 10000 | 11 |
+-------+-----------+----------+-------------+----------+
Now if you query for IDs in the issuetype
table:
mysql> select id from issuetype order by id;
+----+
| id |
+----+
| 1 |
| 15 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
+----+
10 rows in set (0.00 sec)
You should notice that on the optionconfiguration
table there is one reference inside optionid
to a value 11
, however, there is not a matching value in IDs of Issue Types:
. . .
| 10609 | issuetype | 11 | 10000 | 9 |
. . .
It's necessary to remove the line from optionconfiguration
.
Notice that the values returned on the queries contain sample data, yours will have different values.
Resolution
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.
- Shutdown JIRA.
Backup JIRA database.
Run query to locate the line that needs to be removed:
select cf.optionid from optionconfiguration cf where cf.fieldid = 'issuetype' and cf.optionid not in (select it.id from issuetype it);
This will provide you an
optionid
. Use this below in place ofXXX
. (e.g. 11)This should return only the result you require:
select * from optionconfiguration where optionid = 'XXX';
Delete the row:
delete from optionconfiguration where optionid = 'XXX';
Re-run query to confirm it has been removed:
select cf.optionid from optionconfiguration cf where cf.fieldid = 'issuetype' and cf.optionid not in (select it.id from issuetype it);
This should return no results.
- Start JIRA.