Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-25329

Renaming Application Links cause rendering problem: "Couldnt find an application link with the name {0}."

      Problem

      Confluence gets lost when renaming application links.

      Error rendering macro 'jira' : Couldnt find an application link with the name {0}.

      Steps to reproduce:

      Confluence 4.2.1 (Win 64-bit)
      JIRA 5.0.3 (Win 64-bit)

      1. Install JIRA
        1. Use Eval DB
        2. Port 8080
        3. Admin: jiraadmin
      2. Install Confluence
        1. Use Eval DB
        2. Port 9090
        3. Admin: confadmin
      3. In JIRA Administration, create App Link to Confluence
        1. URL: http://<hostname>:9090
        2. Name: JIRA (localhost)
        3. NOT a trusted link
        4. Create reciprocal link
        5. Configure link for Oauth, both ways
      4. Change default permission scheme to allow "Anyone" the "Browse projects" right
      5. Create JIRA project
      6. Create test issue in JIRA, copy the URL to the clipboard
      7. Go to Confluence dashboard
      8. Create new page
        1. Paste URL from JIRA into page (Confluence automatically converts it to the JIRA issue macro)
        2. Or "Insert Jira Issue" and then select a single JIRA Issue.
        3. Save page
        4. NOTE: No error message
      9. Go to Confluence Administration
        1. Go to application links
        2. Configure the link
        3. Rename the "Application Name" to something different
        4. E.g., "JIRA (localhost)" -> "JIRA (localhost) - Test Rename"
      10. Reload the Confluence page you previously created
        1. Note the error in place of the macro to the JIRA issue.

      Workaround

      Delete and Recreate the Link with Another name.

            [CONFSERVER-25329] Renaming Application Links cause rendering problem: "Couldnt find an application link with the name {0}."

            @Robert Stooß, see my comment right above yours. Try rerunning the upgrade step manually (see my comment from 24/Apr/2015 2:30 PM).

            Stefan Hett added a comment - @Robert Stooß, see my comment right above yours. Try rerunning the upgrade step manually (see my comment from 24/Apr/2015 2:30 PM).

            DKB Service GmbH added a comment - - edited

            Hi

             

            we are on Confluence 6.0.4 and after importing a Confluence backup from our prod.Environment into out test.Environment These macro related issue instantly Show up after (of course i had to) renaming and changing the application Links (URL and Name)

            how was this fixed in verison 5.1 ?

            DKB Service GmbH added a comment - - edited Hi   we are on Confluence 6.0.4 and after importing a Confluence backup from our prod.Environment into out test.Environment These macro related issue instantly Show up after (of course i had to) renaming and changing the application Links (URL and Name) how was this fixed in verison 5.1 ?

            After upgrading from Confluence 5.3.4 to Confluence 5.4.4 the issue with copy/pasting JIRA links not adding the serverID-parameter is not reproducible anymore. Therefore assuming that this issue has been resolved.

            Note however, that old issues which were still missing the serverID-parameter have not been updated. The workaround I used was to rerun the upgrade step manually.

            Stefan Hett added a comment - After upgrading from Confluence 5.3.4 to Confluence 5.4.4 the issue with copy/pasting JIRA links not adding the serverID-parameter is not reproducible anymore. Therefore assuming that this issue has been resolved. Note however, that old issues which were still missing the serverID-parameter have not been updated. The workaround I used was to rerun the upgrade step manually.

            Stefan Hett added a comment - - edited

            Mystery still not 100% solved and still in contact with the support.

            For once the support pointed out that the query stated above is not quite correct. The upgrade process only upgrades the current version of documents (see Confluence upgrade notes for Confluence 5.3 where this limitation is stated) and therefore this upgrade step also just modifies the current version of a page. The query above however also reports all historical pages.

            So this is the query which (according to my current understanding) should return no issues, if the upgrade process succeeded (query for Confluence >= 5.3 - for < 5.3 it requires the ac:structured-macro to be replaced with ac:macro):

            SELECT * FROM (SELECT * FROM bodycontent where body like '%<ac:structured-macro ac:name="jira">%') AS sb
            WHERE body not like '%<ac:parameter ac:name="serverId">%' and contentid in (SELECT contentid FROM CONTENT WHERE CONTENTTYPE = 'PAGE' AND PREVVER IS NULL);
            

            Please note that this query is still not 100% accurate. It also reports matches for pages which have been removed (and are in the trash container). The upgrade process doesn't touch these either. That's then not an actual problem (unless I guess u restore the pages, in which case u'd have to manually rerun the upgrade task I guess — not confirmed and won't check).

            Note that there is still an old issue for older Confluence/JIRA issues though - tested with JIRA 6.1.9 and Confluence 5.3.4. Copy-pasting a link from JIRA into Confluence doesn't add the serverID-parameter. It is reported by support that this is not reproducible with JIRA 6.4.x+Confluence 5.8.x. Will update this comment once I know which version fixed that problem.

            Stefan Hett added a comment - - edited Mystery still not 100% solved and still in contact with the support. For once the support pointed out that the query stated above is not quite correct. The upgrade process only upgrades the current version of documents (see Confluence upgrade notes for Confluence 5.3 where this limitation is stated) and therefore this upgrade step also just modifies the current version of a page. The query above however also reports all historical pages. So this is the query which (according to my current understanding) should return no issues, if the upgrade process succeeded (query for Confluence >= 5.3 - for < 5.3 it requires the ac:structured-macro to be replaced with ac:macro): SELECT * FROM (SELECT * FROM bodycontent where body like '%<ac:structured-macro ac:name= "jira" >%' ) AS sb WHERE body not like '%<ac:parameter ac:name= "serverId" >%' and contentid in (SELECT contentid FROM CONTENT WHERE CONTENTTYPE = 'PAGE' AND PREVVER IS NULL); Please note that this query is still not 100% accurate. It also reports matches for pages which have been removed (and are in the trash container). The upgrade process doesn't touch these either. That's then not an actual problem (unless I guess u restore the pages, in which case u'd have to manually rerun the upgrade task I guess — not confirmed and won't check). Note that there is still an old issue for older Confluence/JIRA issues though - tested with JIRA 6.1.9 and Confluence 5.3.4. Copy-pasting a link from JIRA into Confluence doesn't add the serverID-parameter. It is reported by support that this is not reproducible with JIRA 6.4.x+Confluence 5.8.x. Will update this comment once I know which version fixed that problem.

            @etom Thanks. I'm already in contact with support and try to solve the issue with them.

            Stefan Hett added a comment - @etom Thanks. I'm already in contact with support and try to solve the issue with them.

            Hi stefan22,

            Your understanding of the upgrade task is correct, I'm sorry that this doesn't seem to be running correctly for you. If there are too many missing serverID entries to be added manually, could you please ask our support team to investigate further?

            edith (Inactive) added a comment - Hi stefan22 , Your understanding of the upgrade task is correct, I'm sorry that this doesn't seem to be running correctly for you. If there are too many missing serverID entries to be added manually, could you please ask our support team to investigate further?

            Stefan Hett added a comment - - edited

            @etom As far as I understand the upgrade task should add the serverID-fields to the JIRA macro entries. So that after a fully successful migration of the old entries, the following query should return no matches:
            SELECT * FROM (SELECT * FROM bodycontent where body like '%<ac:macro ac:name="jira">%') AS sb where body not like '%<ac:parameter ac:name="serverId">%';

            However in our case it still does.
            Whenever I set the application link to the old (not yet updated) server name and re-run the upgrade task, the logs report that x entries were updated. But checking the database afterwards, no serverID entry was added for these and after changing the name of the application link back to the proper name and rerunning the upgrade task then reports again x entries failed to upgrade.

            I think we can manually add the missing serverID entries for the JIRA macros, but I was under the impression that the set-up upgrade task should actually solve these cases.

            Stefan Hett added a comment - - edited @etom As far as I understand the upgrade task should add the serverID-fields to the JIRA macro entries. So that after a fully successful migration of the old entries, the following query should return no matches: SELECT * FROM (SELECT * FROM bodycontent where body like '%<ac:macro ac:name="jira">%') AS sb where body not like '%<ac:parameter ac:name="serverId">%'; However in our case it still does. Whenever I set the application link to the old (not yet updated) server name and re-run the upgrade task, the logs report that x entries were updated. But checking the database afterwards, no serverID entry was added for these and after changing the name of the application link back to the proper name and rerunning the upgrade task then reports again x entries failed to upgrade. I think we can manually add the missing serverID entries for the JIRA macros, but I was under the impression that the set-up upgrade task should actually solve these cases.

            If anybody is wondering (like I was): The upgrade process can be rerun by going to the following URL: <ConfluenceBaseURL>/admin/do-force-upgrade.action

            The upgrade task is called: "jiraIssueMacroServerParamsUpgradeTask".

            Thanks to Atlassian support, who pointed me there.

            Stefan Hett added a comment - If anybody is wondering (like I was): The upgrade process can be rerun by going to the following URL: <ConfluenceBaseURL>/admin/do-force-upgrade.action The upgrade task is called: "jiraIssueMacroServerParamsUpgradeTask". Thanks to Atlassian support, who pointed me there.

            For the quick fix, run the following update over Confluence database (replace Wrong link name and Correct link name with your names):

            update bodycontent set body = replace(body,
            '<ac:parameter ac:name="server">Wrong link name</ac:parameter>',
            '<ac:parameter ac:name="server">Correct link  name</ac:parameter>') where body like '%<ac:macro ac:name="jira">%';
            commit;
            

            Then flush confluence cache from administrative backend.

            Gregory Kneller added a comment - For the quick fix, run the following update over Confluence database (replace Wrong link name and Correct link name with your names): update bodycontent set body = replace(body, '<ac:parameter ac:name= "server" >Wrong link name</ac:parameter>' , '<ac:parameter ac:name= "server" >Correct link name</ac:parameter>' ) where body like '%<ac:macro ac:name= "jira" >%' ; commit; Then flush confluence cache from administrative backend.

            Anatoli added a comment -

            Tested the upgrade - the upgrade run correctly and the right things were updated and ID added:

            2013-03-13 10:41:35,735 INFO [main] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] doMigration Started migration of JIRA Issue macros
            2013-03-13 10:41:35,909 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] processParams Failed to update JIRA issue macro: no application link found with name 'Atlassian JIRA'
            2013-03-13 10:41:35,911 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] update Updated JIRA issue macro: added serverId param for 'Atlassian JIRA CHANGED'
            2013-03-13 10:41:36,005 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] update Updated JIRA issue macro: added serverId param for 'Atlassian JIRA CHANGED'
            2013-03-13 10:41:36,027 INFO [main] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] doMigration Finished migration of JIRA Issue macros:
            0 JIRA Issue macro(s) did not require any changes
            2 JIRA Issue macro(s) were updated
            1 JIRA Issue macro(s) could not be updated
            

            I tested the manually running the upgrade task to make sure the proposed workaround works and it does!

            Anatoli added a comment - Tested the upgrade - the upgrade run correctly and the right things were updated and ID added: 2013-03-13 10:41:35,735 INFO [main] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] doMigration Started migration of JIRA Issue macros 2013-03-13 10:41:35,909 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] processParams Failed to update JIRA issue macro: no application link found with name 'Atlassian JIRA' 2013-03-13 10:41:35,911 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] update Updated JIRA issue macro: added serverId param for 'Atlassian JIRA CHANGED' 2013-03-13 10:41:36,005 INFO [jira-issue-macro-migration:thread-1] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] update Updated JIRA issue macro: added serverId param for 'Atlassian JIRA CHANGED' 2013-03-13 10:41:36,027 INFO [main] [xhtml.migration.macro.JiraIssueMacroServerParamsMigrator] doMigration Finished migration of JIRA Issue macros: 0 JIRA Issue macro(s) did not require any changes 2 JIRA Issue macro(s) were updated 1 JIRA Issue macro(s) could not be updated I tested the manually running the upgrade task to make sure the proposed workaround works and it does!

              etom edith (Inactive)
              gcheck GuilhermeA
              Affected customers:
              13 This affects my team
              Watchers:
              17 Start watching this issue

                Created:
                Updated:
                Resolved: