Re-Indexing fails with java.lang.NullPointerException on Link Type Indexing
Symptoms
When trying to re-index JIRA, the below error is displayed.
java.util.concurrent.ExecutionException: java.lang.NullPointerException
Task completed in 5 seconds with unexpected error.
Started Today 11:07 AM.
Finished Today 11:07 AM.
The following appears in the atlassian-jira.log
:
2012-06-14 09:40:13,374 main ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35)
at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:257)
...
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
...
Caused by: java.lang.NullPointerException
at com.atlassian.jira.issue.index.indexers.impl.SubTaskIndexer.addIndex(SubTaskIndexer.java:54)
at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)
Cause
The link type for a sub-task is not linked together correctly. The Zephyr for JIRA (v.1.7) plugin has logic in it which will check for, and create a issueLinkType "Relates". It also creates a link using the id 10003, which can cause errors if these links have been renamed or changed.
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.
Find out which linking type is being affected:
SELECT * from issuelink where linktype NOT IN (SELECT id from issuelinktype);
Check the current link types to see which one to assign to the corrupted entry. They can be identified with the below:
SELECT id, linkname from issuelinktype;
Update the corrupted entry to the link type from the previous SQL:
UPDATE issuelink SET linktype = <issuetlinktype_id> where id = <result_from_first_query>;
- Stop JIRA.
- Remove the
$JIRA_HOME/caches/indexes
directory. This will be rebuilt when JIRA is indexed again. - Start JIRA.
The above SQL is for PostgreSQL and may need to be modified, depending on the type of database the JIRA instance uses.