Cannot retrieve link and provider entity when creating Application Link

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

After creating an Application Link between two Atlassian applications, the link does not appear as configured on one side of the application. This will be encountered when connecting an older Atlassian application to a newer one. For example, creating an Application Link between Fisheye/Crucible 3.10 and Bitbucket Server 4.5 will result in Fisheye/Crucible not displaying the Application Link.

The following error can be seen in the application logs:

2016-05-03 15:04:57,996 ERROR [AppLinks ConcurrentExecutor:thread-9 ] com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource ListApplicationLinksUIResource$2$1-callWithContext - Cannot retrieve link and provider entity for Bitbucket (d25a1ac3-6a6d-38cd-a3ab-a87062eaed55) https://bitbucket.company.com

If the creation of the Application Link is attempted again the following error will appear in the UI:

An Application Link to this URL 'https://bitbucket.company.com' has already been configured.

Environment

This issue can occur when running an older Atlassian application that comes bundled with Shared Access Layer (SAL) 2.13 and below and a newer application that is running Tomcat 8.0.30+.

  • An Atlassian application with SAL 2.13 or below, to check which version of SAL is bundled, see SAL Version Matrix.
  • An Atlassian application with Tomcat 8.0.30+, currently the following applications come bundled with Tomcat 8.0.30+:
    • Bamboo 5.11+
    • Bitbucket Server 4.5+
    • Confluence 5.9+
    • JIRA 7.1.7+

Diagnostic Steps

  • On the application running SAL 2.13 and below increase the logging level to DEBUG for the  com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource class and refresh the Application Link page.

    Bamboo

    1. Log into Bamboo as a user with administrative permissions

    2. Click the "cog" icon and select Overview

    3. On the left, click Log settings

    4. In the field Classpath enter com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource

    5. Click Add

    Bitbucket Server


    curl -u <USER> -v -X PUT -d "" -H "Content-Type: application/json" "https://bitbucket.company.com/rest/api/latest/logs/logger/com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource/debug"
    Fisheye/Crucible

    Stop Fisheye/Crucible

    Edit the file <Fisheye  install directory>/log4j.xml, adding the following to it:


    <logger name="com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource">
        <level value="DEBUG"/>
    </logger>
              

    Save the file and start Fisheye/Crucible again within this file, you'll see there are other loggers by default. You can add this one at the same level of the hierarchy in which the other loggers are located.

    JIRA

    1. Log into JIRA with System Administration Privileges

    2. Click the "cog" icon and select System

    3. On the left, click Logging and Profiling

    4. Under Default Logger, select the option to configure logging for another package

    5. Under Package enter com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource and for Logging level select Debug

  • Navigate to the Application Link page and the following exception will be present in the logs: 

    2016-05-03 15:04:57,996 DEBUG [AppLinks ConcurrentExecutor:thread-9 ] com.atlassian.applinks.core.rest.ui.ListApplicationLinksUIResource ListApplicationLinksUIResource$2$1-callWithContext - Exception: 
    java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: host must not be null
    2016-06-16 22:07:33,930 http-bio-8080-exec-5936 ERROR /rest/applinks/3.0/listApplicationlinkstates/id/e3c165b1-4812-31a9-90e1-e564941e5a52 [core.rest.ui.ApplicationLinkStatesUIResource] Error occurred when retrieving application link state
    java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: host must not be null
    	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    	at com.atlassian.applinks.core.rest.ui.ApplicationLinkStatesUIResource.getApplicationLinkState
  • The Location header is returned and can also be checked with  the command  curl -i https://bitbucket.company.com
    • Applications running Tomcat 8.0.29 and below will return the following: 

      HTTP/1.1 302 Found
      Server: Apache-Coyote/1.1
      Location: https://bitbucket.company.com/projects
      Transfer-Encoding: chunked
      Date: Fri, 13 May 2016 19:37:58 GMT
    • Applications running Tomcat 8.0.30+ will return the following: 

      HTTP/1.1 302 Found
      Server: Apache-Coyote/1.1
      Location: /projects
      Transfer-Encoding: chunked
      Date: Fri, 13 May 2016 19:37:58 GMT

Tomcat 8.0.30 introduced a change that results in the 302 response Location header being returned to use a relative path. Specifically, this was 56917 which changes this based on the RFC7231 standard. This change in the Location header triggers a bug in SAL 2.13 and older when it's calling the Apache HTTPClient and results in the Application Link not being displayed.

The previous behavior of returning the full URL in the Location header can be changed in Tomcat by doing the following in the application running Tomcat 8.0.30+.

  1. Stop the application
  2. Modify the Context in server.xml to add the useRelativeRedirects attribute. 

    <Context docBase="${catalina.home}/<atlassian-application>"
                             path=""
                             reloadable="false"
                             useHttpOnly="true"
                             useRelativeRedirects="false" />

    The docBase will vary depending on the application. Eg. for JIRA it would be "${catalina.home}/atlassian-jira", for Bitbucket Server it would be "${catalina.home}/atlassian-bitbucket".

  3. Start the application

This should be enough for solving the issue. If you recreate the AppLinks, you should be fine for most use cases but there is an edge-case that could affect Bamboo. Please refer to No application link found for Stash repository: Stash.

Upgrade all Atlassian application to a version that comes bundled with SAL 3.0.1+. Consult the SAL Version Matrix to determine which version to upgrade to.

Description

After creating an Application Link between two Atlassian applications, the link does not appear as configured on one side of the application. This will be encountered when connecting an older Atlassian application to a newer one. For example, creating an Application Link between Fisheye/Crucible 3.10 and Bitbucket Server 4.5 will result in Fisheye/Crucible not displaying the Application Link.

ProductJira, Confluence, Bamboo, Fisheye, Bitbucket
PlatformServer, Cloud, Data Center
Last modified on Nov 15, 2019

Was this helpful?

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