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.


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

  1. Simply deleting the Application Link from Jira may not rectify the problem. The steps to delete it from the Jira are as follows:
    1. Go to System > Application Links > Click on the three dots > Remove link.
  2. 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.
    1. Remove the app links from both Jira - System > Application Links > Click on the three dots > Remove link.
    2. Take backup of the JIRA Instance  - Backing up the database
    3. Shutdown Jira
    4. Run the following query on JIRA's database to delete oauth token from JIRA:

      DELETE FROM oauthconsumertoken;
    5. Start Jira 

    6. Re-create the application Links again


Last modified on Apr 3, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.