Bitbucket Server SSH server fails to start due to 'BouncyCastle is not registered as expected'
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
Problem
When starting up the Bitbucket Server application the ssh plugin does not start up.
The following appears in the atlassian.bitbucket.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2015-06-10 00:26:21,021 ERROR [ThreadPoolAsyncTaskExecutor::Thread 22] c.a.plugin.osgi.factory.OsgiPlugin Unable to start the plugin container for plugin 'com.atlassian.bitbucket.ssh-plugin'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sshServer' defined in URL [bundle://49.0:0/META-INF/spring/atlassian-plugins-components.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bitbucket.internal.ssh.server.SshServer]: Constructor threw exception; nested exception is java.lang.IllegalStateException: BouncyCastle is not registered as expected
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_40]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_40]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_40]
... 17 frames trimmed
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bitbucket.internal.ssh.server.SshServer]: Constructor threw exception; nested exception is java.lang.IllegalStateException: BouncyCastle is not registered as expected
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
... 5 common frames omitted
Caused by: java.lang.IllegalStateException: BouncyCastle is not registered as expected
at com.google.common.base.Preconditions.checkState(Preconditions.java:145) ~[guava-11.0.2-atlassian-02.jar:na]
at com.atlassian.bitbucket.internal.ssh.server.SshServer.<init>(SshServer.java:61) ~[na:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
... 5 common frames omitted
Diagnosis
Diagnostic Steps
Within the application.xml file in a generated support.zip from Bitbucket Server you can see that the com.atlassian.bitbucket.ssh-plugin 's status is disabled.
1
2
3
4
5
6
7
8
<plugin>
<key>com.atlassian.bitbucket.ssh-plugin</key>
<version>3.2.4</version>
<vendor>Atlassian</vendor>
<status>DISABLED</status>
<vendor-url>http://www.atlassian.com</vendor-url>
<framework-version>2</framework-version>
</plugin>
Cause
The presence of the following JAVA option will cause this error:
1
-Dsun.net.spi.nameservice.provider.1=dns,sun
Solution
Resolution
Remove the option and restart the Bitbucket Server service.
The java arguments may be set on $BITBUCKET_INST/bin/_start-webapp.sh or in the Windows/Linux service.
Was this helpful?