NullPointerException when creating issue, editing issue, move issue, accessing the Screen tab from the Project

お困りですか?

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

コミュニティに質問

症状

A NullPointerException is generated when creating issue, editing issue, 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'.

または

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'.

原因

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  JRA-45161 - Getting issue details... STATUS .

診断

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.

ソリューション

データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。

  1. Jira をシャットダウンします。
  2. Backup JIRA database.

  3. 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 of XXX. (e.g. 11)

  4. This should return only the result you require:

    select * from optionconfiguration where optionid = 'XXX';
  5. Delete the row:

    delete from optionconfiguration where optionid = 'XXX';
  6. 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.

  7. Jira を起動します。
最終更新日 2018 年 6 月 28 日

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

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