Jira displays 'com.atlassian.cache.CacheException: java.lang.NullPointerException: consumer' when deleting Application Link
Platform Notice: Server, Data Center, and Cloud By Request - This article was written for the Atlassian server and data center platforms but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.
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 は除く
問題
When trying to delete an Application Link in Jira, the link cannot be deleted and Jira displays a warning related to 'com.atlassian.cache.CacheException: java.lang.NullPointerException: consumer'. This will also cause the features of the Application Link to not function and the following appears in the atlassian-jira.log
:
ajp-nio-127.0.0.104-8009-exec-4 WARN user 455x61414x2 1ec9rm1 192.168.1.10 /secure/RapidBoard.jspa [com.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'com.atlassian.cache.CacheException: java.lang.NullPointerException: consumer'.
診断
Run the following query and look for a difference in the consumer_key
between rows. If there is a difference between consumer_key
for rows with the same token_key
(excluding the username part) you're likely affected by this issue.
select * from oauthconsumertoken;
id | created | token_key | token | token_secret | token_type | consumer_key
-------+----------------------------+--------------------------------------------------+----------------------------------+----------------------------------+------------+-------------------------------------------
10309 | 2015-07-01 19:35:59.842+00 | a5f05bf0-3feb-3479-b101-d5ac9e8ea56d:user1 | XIUnPN1Qc982jufnQypngok5IBWqoIWu | FM2lRWLrOHhXLdYwJtwwFI4SO3aftiQV | ACCESS | jira:2225f1ed-e21b-4ada-a40e-3ad49c79d7b4
10703 | 2015-08-04 19:03:09.688+00 | a5f05bf0-3feb-3479-b101-d5ac9e8ea56d:user2 | ZWrNaIKeQTc7NlSZKTwYqlTZpfm5cEh0 | LuIBzKD6ZmF2gPXZ2CFojBKJpb0HgYlV | ACCESS | jira:0f5f4683-0376-418e-ba8b-28b621649018
(2 rows)
So in the example above we can see the two token_key values are the same (minus the user part at the end)
a5f05bf0-3feb-3479-b101-d5ac9e8ea56d:user1
a5f05bf0-3feb-3479-b101-d5ac9e8ea56d:user2
But the consumer_keys for the two rows differ
jira:2225f1ed-e21b-4ada-a40e-3ad49c79d7b4
jira:0f5f4683-0376-418e-ba8b-28b621649018
原因
This is caused by a stale consumer key being used and can occur after a migration to a new instance of Jira.
ソリューション
- Jira を停止します。
- Create a backup of the Jira database
- Identify the stale (old)
consumer_key
from the rows returned by the SQL query ran in the diagnosis section. The staleconsumer_key
is the one from the row that has the oldest value in the created column.- Taking the SQL query result from the example above, the stale consumer key is "jira:2225f1ed-e21b-4ada-a40e-3ad49c79d7b4" (since it has the oldest created value)
Run the following query to deleted the old record, after replacing <STALE_CONSUMER_KEY> with the consumer key identified in the previous step:
delete from oauthconsumertoken where consumer_key = '<STALE_CONSUMER_KEY>';
- Jira の起動
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。