Issue when creating an application link between Bitbucket and Jira

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.

1 2 3 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:

1 2 3 4 5 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.

(Auto-migrated image: description temporarily unavailable)

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:

      1 DELETE FROM oauthconsumertoken;
    5. Start Jira 

    6. Re-create the application Links again

Updated on March 11, 2025

Still need help?

The Atlassian Community is here for you.