Unable to Add Confluence as A Trusted Application
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
Symptoms
Adding Confluence to JIRA as a trusted application fails. Visiting http://<confluence url>/admin/appTrustCertificate produces the following stack trace:
java.lang.NullPointerException
org.apache.commons.codec.digest.DigestUtils.md5(DigestUtils.java:86)
com.atlassian.confluence.security.trust.DefaultTrustedApplicationsManager.getAliasForSid(DefaultTrustedApplicationsManager.java:141)
com.atlassian.confluence.security.trust.DefaultTrustedApplicationsManager.getSystemAlias(DefaultTrustedApplicationsManager.java:135)
com.atlassian.confluence.security.trust.DefaultTrustedApplicationsManager.getCurrentApplication(DefaultTrustedApplicationsManager.java:115)
sun.reflect.GeneratedMethodAccessor1001.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
java.lang.NullPointerException
at com.atlassian.confluence.applinks.ConfluenceInternalHostApplication.getId(ConfluenceInternalHostApplication.java:212)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129)
at $Proxy154.getId(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
Diagnosis
When going to Confluence license key panel, the Server ID looks like:
Server ID $action.serverId
Cause
Trusted application works by retrieving a Public Key from the application it's going to trust. In this case, Confluence failed to produce a public key because it does not have a server id in the database.
Solution
Resolution
First Step: Restore the Server ID
You will need to retrieve the server ID from <confluence data>/confluence.cfg.xml
into the database. This can be done by executing a java script from CONFSERVER-10576 - Upgrade fails due to NullPointerException in ConfluenceTrustedApplicationsManager
Please follow the instruction here (applies for Confluence 3.x as well).
Second Step: Initialize KEYSTORE table in Confluence database
Newer Confluence versions (7.19.X and 8.5.X) do no longer allow JSP files to be loaded from the <confluence-install-dir>. Hence, you need to follow the steps in CONFSERVER-93646 - Page Not Found error when executing JSP file to initialize an empty KEYSTORE table for this resolution.
Download a JSP file called initKeyStore_2_10.jsp from CONFSERVER-11074 - Write JSP to initalise KEYSTORE table. Despite its name, it works with Confluence 3.x.
Place it in your
<confluence install>/confluence/admin
folderRestart Confluence
Open a browser to
http://<confluence url>/admin/initKeyStore_2_10.jsp
Click on the 'Proceed' button
ℹ️ Confirm by visiting http://<confluence url>/admin/appTrustCertificate. Some text with an encoded key should appear, rather than the stacktrace above.
If you are running on Confluence 4 and later, you may instead download a JSP file called initKeyStore_4_2.jsp from CONFSERVER-11074 - Write JSP to initalise KEYSTORE table and follow the same instructions above.
Was this helpful?