Applinks between JIRA and Confluence can't be created due to obsolete applinks IDs in Confluence database
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Problem
It's fine to create applinks from JIRA to Confluence, however the reciprocal link can't be created. Confluence complains that the JIRA URL is invalid and asks for Consumer key to proceed. The following WARNs can be seen from Confluence log:
2017-03-06 20:57:24,369 WARN [AtlassianEvent::CustomizableThreadFactory-3] [applinks.internal.capabilities.DefaultRemoteCapabilitiesService] getApplinkSafe Exception trying to get Applink for manifest with ID 3ffde444-4275-38f8-961b-91837ea4f27a
-- url: /rest/applinks/3.0/applicationlinkForm/manifest.json | traceId: b803eeff136826b6 | userName: <user_name> | referer: http://172.30.200.9:8086/plugins/servlet/applinks/listApplicationLinks?applinkCreationStatusLog=%22%5B%7B%5C%22status%5C%22%3A%5C%22inprogress.creation%5C%22%7D%2C%7B%5C%22status%5C%22%3A%5C%22completed.creation.local%5C%22%7D%2C%7B%5C%22status%5C%22%3A%5C%22inprogress.creation.reciprocal%5C%22%7D%5D%22&applinkOriginalCreatedId=%2238146275-d678-3118-a06e-d65c9aee3c74%22&sharedUserbase=true&applinkConfigInUserAuth=true&applinkConfigInServerAuth=true&applinkConfigInPreAuth=true&applinkConfigOutUserAuth=true&applinkConfigOutServerAuth=true&applinkConfigOutPreAuth=true&applinkStartingUrl=%22http%3A%2F%2F172.30.192.10%3A8088%22&applinkStartingType=%22jira%22
...
2017-03-06 20:57:34,577 WARN [http-nio-8086-exec-16] [atlassian.applinks.core.DefaultApplicationLinkService] retrieveApplicationLink Couldn't find type id for application link with id 3ffde444-4275-38f8-961b-91837ea4f27a. Link is corrupted
-- referer: http://172.30.200.9:8086/plugins/servlet/applinks/listApplicationLinks?applinkCreationStatusLog=%22%5B%7B%5C%22status%5C%22%3A%5C%22inprogress.creation%5C%22%7D%2C%7B%5C%22status%5C%22%3A%5C%22completed.creation.local%5C%22%7D%2C%7B%5C%22status%5C%22%3A%5C%22inprogress.creation.reciprocal%5C%22%7D%5D%22&applinkOriginalCreatedId=%2238146275-d678-3118-a06e-d65c9aee3c74%22&sharedUserbase=true&applinkConfigInUserAuth=true&applinkConfigInServerAuth=true&applinkConfigInPreAuth=true&applinkConfigOutUserAuth=true&applinkConfigOutServerAuth=true&applinkConfigOutPreAuth=true&applinkStartingUrl=%22http%3A%2F%2F172.30.192.10%3A8088%22&applinkStartingType=%22jira%22 | url: /rest/applinks/3.0/applicationlink | traceId: 76a9844691805253 | userName: <user_name>
...
2017-03-06 21:20:51,397 WARN [http-nio-8086-exec-28] [atlassian.applinks.core.DefaultApplicationLinkService] retrieveApplicationLink Couldn't find type id for application link with id 47cdea51-7966-32e3-a08c-fbfd60c5f7c8. Link is corrupted
-- url: /plugins/servlet/streams | traceId: 99ef7bde818df7b7 | userName: <user_name>
Diagnosis
In the sample stack trace above, take note of this:
Couldn't find type id for application link with id <ID>. Link is corrupted
There may be a number of different IDs, while the applinks page in Confluence may not have any applinks. This indicates that there're obsolete applinks IDs in the Confluence database.
Note
There's a complete Application Links Troubleshooting Guide. Please ensure to double-check your network, proxy settings, and SSL certificates before referring to this specific KB. This KB only applies when all the network-related matters have been ruled out e.g.:
- JIRA URL is absolutely valid and can be reached from the Confluence server
- There's no PKIX error related to SSL certificate
The last thing we should look into is the database.
Cause
There are obsolete applinks IDs in the Confluence database that seem to confuse Confluence, making it think that JIRA applinks has been configured incorrectly.
The following SQL query run against Confluence database will show the valid applinks IDs, if any:
select * from bandana where bandanakey like 'applinks.admin%name';
The number of results should match the number of applinks in Confluence's applinks page, and the applinks name/s should also match. For example:
BANDANAID | BANDANACONTEXT | BANDANAKEY | BANDANAVALUE |
---|---|---|---|
10944528 | _GLOBAL | applinks.admin.b2693708-529b-3dda-804b-9c1a6d3e78e5.name | <string>ExistingApplinks</string> |
In this case:
The valid applinks ID is b2693708-529b-3dda-804b-9c1a6d3e78e5 and you should see ExistingApplinks from Confluence's applinks page
According to the WARNs from the Problem section, the obsolete applinks IDs are (there are no other applinks on Confluence's applinks page):
3ffde444-4275-38f8-961b-91837ea4f27a
47cdea51-7966-32e3-a08c-fbfd60c5f7c8
The following SQL query will then show us the obsolete applinks IDs:
select * from bandana where bandanakey like 'applinks.global%';
The output should look like this (containing both valid and invalid IDs):
BANDANAID | BANDANACONTEXT | BANDANAKEY | BANDANAVALUE |
---|---|---|---|
229446 | _GLOBAL | applinks.global.application.ids | <list> |
Resolution
Ensure that you've made appropriate backups of Confluence's database.
We need to delete the obsolete IDs. In this case run this SQL query (keep only the valid ID/s):
update bandana set bandanavalue = '<list>
<string>b2693708-529b-3dda-804b-9c1a6d3e78e5</string>
</list>' where bandanakey like 'applinks.global%';
then restart Confluence and recreate the applinks.
Note
In case the Confluence applinks page has no applinks at all, this query should return nothing:
select * from bandana where bandanakey like 'applinks.admin%name';
In that case, the applinks.global.application.ids key should only contain invalid IDs, so we should delete it:
delete from bandana where bandanakey like 'applinks.global%';
If you're unsure, contact Atlassian Support and provide us with the outputs of the SELECT queries only.