Issue when creating an application link between Bitbucket and Jira
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
Summary
When "local authentication" OAuth is chosen for both Jira and Bitbucket, Bitbucket displays a "Connected" status, but Jira encounters a Network error.
We couldn't connect to Bitbucket at https://xxxxx. This might have been caused by a network error or another configuration error.
''''com.atlassian.cache.CacheException: java.lang.NullPointerException: consumer
This error was discovered in atlassian-jira.log:
2023-08-28 11:56:32,493 https-jsse-nio-8443-exec-8 DEBUG next 716x7152x4 /rest/applinks/3.0/status/cc003b22-06eb-3cfc-8eec-830262bb404c [c.a.a.i.migration.remote.RemoteActionHandler] {"message":"Client must be authenticated to access this resource.","status-code":401}
2023-08-28 11:56:32,494 https-jsse-nio-8443-exec-8 /rest/applinks/3.0/status/cc003b22-06eb-3cfc-8eec-830262bb404c [c.a.a.core.auth.AuthenticatorAccessor] Looking for interface com.atlassian.applinks.api.auth.types.OAuthAuthenticationProvider for application link Bitbucket
2023-08-28 11:56:32,494 /rest/applinks/3.0/status/cc003b22-06eb-3cfc-8eec-830262bb404c [c.a.a.core.property.ApplicationLinkProperties] Getting provider config; key: com.atlassian.applinks.api.auth.types.OAuthAuthenticationProvider
2023-08-28 11:56:32,497 https-jsse-nio-8443-exec-8 WARN /rest/applinks/3.0/status/cc003b22-06eb-3cfc-8eec-830262bb404c [c.a.applinks.core.DefaultApplinkStatusService] Unrecognized error while attempting to retrieve status of Application Link 'cc003b22-06eb-3cfc-8eec-830262bb404c'
2023-08-28 11:56:32,497 https-jsse-nio-8443-exec-8 /rest/applinks/3.0/status/cc003b22-06eb-3cfc-8eec-830262bb404c [c.a.applinks.core.DefaultApplinkStatusService] Unrecognized error trace for 'cc003b22-06eb-3cfc-8eec-830262bb404c'com.atlassian.cache.CacheException: java.lang.NullPointerException: consumer
Environment
Jira Data Center environments
Diagnosis
When OAuth (impersonation) is selected as the "local authentication" method, it functions correctly for both Jira and Bitbucket, displaying a "connected" status.
Cause
This could be happening after a Bitbucket migration from one AWS account to another. The Application link page might show connected but the connection through Bitbucket does not work.
Solution
- Simply deleting the Application Link from Jira may not rectify the problem. The steps to delete it from the Jira are as follows:
- Go to System > Application Links > Click on the three dots > Remove link.
- If deleting the application link through the Jira doesn't solve the problem, you may need to remove it from the database as well. You can do so by following these steps: This problem could be due to an issue with the consumer key, which is preventing the application link connection from functioning.
- Remove the app links from both Jira - System > Application Links > Click on the three dots > Remove link.
- Take backup of the JIRA Instance - Backing up the database
- Shutdown Jira
Run the following query on JIRA's database to delete oauth token from JIRA:
DELETE FROM oauthconsumertoken;
Start Jira
Re-create the application Links again