Application Link page erroring with NullPointerException or IllegalStateException in Bamboo
問題
When Creating or Viewing Application Links a HTTP 500 Internal Server error occurs at <bamboo-baseURL>/plugins/servlet/applinks/listApplicationLinks
with one of the following exceptions:
com.atlassian.templaterenderer.RenderingException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getOrphanedTrustCertificates' in class com.atlassian.applinks.ui.velocity.ListApplicationLinksContext threw exception java.lang.NullPointerException at com/atlassian/applinks/ui/admin/list_application_links.vm[line 66, column 20]
at com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.render(VelocityTemplateRendererImpl.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
com.atlassian.templaterenderer.RenderingException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getOrphanedTrustCertificates' in class com.atlassian.applinks.ui.velocity.ListApplicationLinksContext threw exception java.lang.IllegalStateException: adminConfig.currentApplication is not properly initialized! at com/atlassian/applinks/ui/admin/common_header.vm[line 11, column 20]
at com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.render(VelocityTemplateRendererImpl.java:109)
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:606)
原因
Cause 1 - NullPointerException:
An Application Link has become corrupted in the database, possibly due to deletion and recreation.
Cause 2 - IllegalStateException: adminConfig.currentApplication is not properly initialized!
Likely misconfiguration in the hosts file.
ソリューション
Cause 1 - NullPointerException:
- Shutdown the Bamboo instance.
Connect to the Bamboo database and execute the following SQL queries:
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。
The following queries will remove all application links, even those that are working correctly. So, if you have more than application integrated with Bamboo, try to remove the links from the UI and contact support for more help.
DELETE FROM trusted_apps_ips; DELETE FROM trusted_apps_urls; DELETE FROM trusted_apps; DELETE FROM bandana WHERE bandana_key LIKE '%applink%'; DELETE FROM bandana WHERE bandana_key LIKE '%com.atlassian.oauth%';
Edit the
<bamboo-home>/xml-data/configuration/administration.xml
file and remove the entire<currentApplication>
tag, if it exists. For example, delete the lines below:<currentApplication> <applicationId>C0A80F180131E4494C2071A449684E94</applicationId> <publicKey>MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgH2SbSdLy4vKr/A0zeAO$</publicKey> <privateKey>MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCAfZJtJ0vLi8q$</privateKey> </currentApplication>
- Restart the Bamboo instance.
- Go to the other application(s) you want to link to Bamboo and remove any application links related to Bamboo.
- Try to configure the the Application Link between the other application(s) and Bamboo again using the correct authentication method, which depends on the user base.
Cause 2 - IllegalStateException: adminConfig.currentApplication is not properly initialized!
Ensure you have configured /etc/hosts (Linux) or C:\Windows\System32\drivers\etc\hosts (Windows):
Run the following command from a Terminal:
# check your $HOSTNAME echo $HOSTNAME # try to ping $HOSTNAME ping $HOSTNAME
If it returns "ping: cannot resolve <hostname>: Unknown host" then add an entry into your /etc/hosts file. For that edit /etc/hosts file and add following:
127.0.0.1 localhost 127.0.0.1 <hostname>