Jira Server or Data Center throws NullPointerException when Epic Link is corrupted
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Summary
Symptom
Jira throws a NullPointerException while executing operations that depend on Search Indexing.
The following appears in the atlassian-jira.log
:
1
2
3
4
5
6
7
8
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
...
Caused by: java.lang.NullPointerException
at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpic(EpicLinkManagerImpl.java:93)
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.getValueFromIssue(EpicLinkCFType.java:71)
at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:373)
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCustomFieldIndexer.addIndex(EpicLinkCustomFieldIndexer.java:38)
...
Diagnosis
The following query should not return any result. In case it does, consult the resolution section.
1
SELECT * FROM issuelink WHERE SOURCE NOT IN (SELECT ID FROM jiraissue);
If for any reason the above query takes a long time to run, here is an alternative query that should return similar results:
1
2
3
4
5
6
SELECT a.*
FROM issuelink a
LEFT OUTER JOIN
jiraissue b
ON a.source = b.id
WHERE B.id IS NULL;
Cause
The cause of this issue is unknown. Possibly related to database transactions that have not been completed successfully, leaving orphan entries in the database.
Solution
Resolution
⚠️ Attention: Please be sure to create a database backup before executing any query.
In some cases, simply executing Using the Database Integrity Checker can solve this issue, but in case it doesn't work, follow the steps below:
Make a backup of your Jira instance.
Shutdown Jira.
Execute the following query:
1
DELETE FROM issuelink WHERE SOURCE NOT IN (SELECT ID FROM jiraissue);
If for any reason the above query takes a long time to run, you can use this one:
1 2 3 4
DELETE FROM issuelink a WHERE NOT EXISTS (SELECT 1 FROM jiraissue b WHERE b.id = a.source);
Restart Jira.
Manually perform a Search Indexing.
If the above steps do not help, then check if there are any issues without issue type in the jiraissue table. If the query below returns any value, then associate them with an issue type and re-index Jira again:
1
SELECT * FROM jiraissue WHERE issuetype IS NULL;
ℹ️ If even after this you still observe errors, please consider going through the Reindexing Jira Server / Data Center causes a Nullpointer Error article.
Was this helpful?