Reindexing Jira Server / Data Center causes a Nullpointer Error

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

症状

Jira throws a NullPointerException while executing operations that depend on Indexing.

atlassian-jira.log に次のメッセージが表示される。

Caused by: java.lang.NullPointerException
at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpic(EpicLinkManagerImpl.java:101)
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCFType.getValueFromIssue(EpicLinkCFType.java:77)
at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:381)
at com.atlassian.greenhopper.customfield.epiclink.EpicLinkCustomFieldIndexer.addIndex(EpicLinkCustomFieldIndexer.java:41)

Or you might see:

java.lang.NullPointerException
	at com.atlassian.jira.issue.index.indexers.impl.SubTaskIndexer.addIndex(SubTaskIndexer.java:47)
	at com.atlassian.jira.issue.index.indexers.FieldIndexer.addIndex(FieldIndexer.java:114)
	at com.atlassian.jira.issue.index.indexers.FieldIndexerWithStats.addIndex(FieldIndexerWithStats.java:57)
	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$Builder.add(DefaultIssueDocumentFactory.java:331)
	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$Builder.addAll(DefaultIssueDocumentFactory.java:307)
	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.getDocument(DefaultIssueDocumentFactory.java:127)
	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.lambda$createDocuments$1(DefaultIssueDocumentFactory.java:112)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

原因

The cause may vary but a few known causes are:

  • Re-indexing following the addition of a 'custom field' when a user is using GreenHopper.
  • If two issues are somehow linked with each other using an issuelinktype which doesn't exist anymore.
  • When an Epic link source is not an Epic, although this is less common.

ソリューション

データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。

1. Run the integrity checker: Using the Database Integrity Checker 

2. Try to Re-index Jira again.  

3. If re-indexing (also startup reindex or catch-up) still fails, then continue on with the next steps.

Please run the following queries on the Jira DB:

3.1 To check if an issue source doesn't exist anymore:

SELECT * FROM issuelink WHERE SOURCE NOT IN (SELECT ID FROM jiraissue);

3.2 To check if an issue type doesn't exist anymore:

SELECT * FROM issuelink WHERE linktype NOT IN (SELECT id FROM issuelinktype);

3.3 To check if an Epic link source is not an Epic:

SELECT *
FROM issuelink l
JOIN issuelinktype ilt on ilt.id=l.linktype
JOIN jiraissue i on l.source=i.id
JOIN issuetype it on it.id=i.issuetype
WHERE ilt.linkname='Epic-Story Link'
AND it.pname<>'Epic'


4. If any of the previous queries returns a result, then:

  • Jira をシャットダウンします。
  • Execute the following query on the DB
    • If the first query (3.1) returns results:
DELETE FROM issuelink WHERE SOURCE NOT IN (SELECT ID FROM jiraissue);
    • If the second query (3.2) returns results:
DELETE FROM issuelink WHERE linktype NOT IN (SELECT id FROM issuelinktype);
    • If the third query (3.3) returns results
DELETE FROM issuelink WHERE id in (
SELECT l.id
FROM issuelink l
JOIN issuelinktype ilt on ilt.id=l.linktype
JOIN jiraissue i on l.source=i.id
JOIN issuetype it on it.id=i.issuetype
WHERE ilt.linkname='Epic-Story Link'
AND it.pname<>'Epic' )
  • Jira を再起動します。
  • Manually perform a re-indexing

5. If re-indexing still fails, then:

  • Run the command
select * from jiraissue where issuetype is null;
  • If this returns any rows, then please find an appropriate issuetype for the issue key returned in the previous query. For this we run: 
select * from issuetype;
  • Once the id of the issue type if identified, run the below sql:
update jiraissue set issuetype = <<id found from the above query>> where id = <<jira issue id found in the first query>>
最終更新日 2024 年 9 月 9 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.