"Required plugin com.atlassian.stash.ssh-plugin has failed to start" is displayed when accessing the Bitbucket Server web interface

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

問題

Bitbucket Server seemingly starts without errors, but when trying to access the Bitbucket Server web interface the following (or a similar) error message is displayed:

Required plugin com.atlassian.stash.ssh-plugin has failed to start.

The log files may show one of the following messages, depending on the specific situation. Use the information below to identify which situation you're facing and the steps to resolve the problem further below.

Situation 1:

atlassian-bitbucket.log に次のメッセージが表示される。

2015-03-15 21:47:23,040 ERROR [spring-startup]  o.s.o.e.i.u.c.RunnableTimedExecution Closing runnable for context NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.bitbucket.ssh, config=osgibundle:/META-INF/spring/*.xml) did not finish in 10000ms; consider taking a snapshot and then shutdown the VM in case the thread still hangs
2015-03-15 21:47:23,063 ERROR [spring-startup]  c.a.plugin.manager.PluginEnabler Unable to start the following plugins due to timeout while waiting for plugin to enable: com.atlassian.bitbucket.ssh-plugin
[...]
2015-03-15 21:47:26,966 ERROR [ThreadPoolAsyncTaskExecutor::Thread 12]  o.s.b.f.s.DefaultListableBeanFactory Destroy method on bean with name 'sshScmProtocol_osgiService' threw an exception
java.lang.IllegalStateException: Invalid BundleContext.
	at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:457) ~[org.apache.felix.framework-3.2.2.jar:na]
	at com.atlassian.bitbucket.plugin.util.EventListenerBeanRegistrar.postProcessBeforeDestruction(EventListenerBeanRegistrar.java:50) ~[bitbucket-plugin-util-3.7.1.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_17]
	at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]
	... 30 frames trimmed
2015-03-15 21:47:26,971 ERROR [ThreadPoolAsyncTaskExecutor::Thread 12]  o.s.b.f.s.DefaultListableBeanFactory Destroy method on bean with name 'sshScmProtocol' threw an exception
java.lang.IllegalStateException: Invalid BundleContext.
	at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:457) ~[org.apache.felix.framework-3.2.2.jar:na]
	at com.atlassian.bitbucket.plugin.util.EventListenerBeanRegistrar.postProcessBeforeDestruction(EventListenerBeanRegistrar.java:50) ~[bitbucket-plugin-util-3.7.1.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_17]
	at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]
	... 30 frames trimmed
2015-03-15 21:47:26,973 ERROR [ThreadPoolAsyncTaskExecutor::Thread 12]  o.s.b.f.s.DefaultListableBeanFactory Destroy method on bean with name 'sshKeyService_osgiService' threw an exception
java.lang.IllegalStateException: Invalid BundleContext.
	at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:457) ~[org.apache.felix.framework-3.2.2.jar:na]
	at com.atlassian.bitbucket.plugin.util.EventListenerBeanRegistrar.postProcessBeforeDestruction(EventListenerBeanRegistrar.java:50) ~[bitbucket-plugin-util-3.7.1.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_17]
	at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]
	... 30 frames trimmed
2015-03-15 21:47:26,976 ERROR [ThreadPoolAsyncTaskExecutor::Thread 12]  o.s.b.f.s.DefaultListableBeanFactory Destroy method on bean with name 'sshConfigurationService_osgiService' threw an exception
java.lang.IllegalStateException: Invalid BundleContext.
	at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:457) ~[org.apache.felix.framework-3.2.2.jar:na]
	at com.atlassian.bitbucket.plugin.util.EventListenerBeanRegistrar.postProcessBeforeDestruction(EventListenerBeanRegistrar.java:50) ~[bitbucket-plugin-util-3.7.1.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_17]
	at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]
	... 30 frames trimmed

 

At the same time the following appears in the catalina.out log file:

15-Mar-2015 21:13:08.554 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [65,569] milliseconds.

(warning) Note: As of Bitbucket Server 5.x+, no logs are written to the BITBUCKET_INSTALL directory. The contents of catalina.out will be written to BITBUCKET_HOME/log/atlassian-bitbucket.log file.

Situation 2:

The following message appears in the atlassian-bitbucket.log file:

2014-05-01 09:27:21,749 ERROR [localhost-startStop-1]  c.a.plugin.manager.PluginEnabler Unable to start the following plugins due to timeout while waiting for plugin to enable: com.atlassian.bitbucket.
ssh-plugin

(warning) Note: This message is also found in the atlassian-bitbucket.log file for situation 1 above, however in situation 2 there are no messages in catalina.out indicating that it took a long time to generate a SecureRandom instance.


Situation 3:

atlassian-bitbucket.log に次のメッセージが出力される。

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

原因

There are different causes of the problem, dependent on the specific situation as described above.

Situation 1:

The output in catalina.out shows that it takes a long time to create a secure random number, which is required for cryptographic purposes in SSH.

This is typically caused by the /dev/random device having insufficient entropy when Bitbucket Server is started. Because this device blocks until sufficient entropy is attained in the system, it blocks the SSH plugin start-up.

(info) We have seen instances of this problem occurring with Bitbucket Server installed on Google Compute Engine instances.

Situation 2:

One or more of the plugins used by Bitbucket Server have become corrupted.

Situation 3:

This issue is known to occur if the following Java option is set:

-Dsun.net.spi.nameservice.provider.1=dns,sun

ソリューション

The steps to resolve the problem depend on the specific situation you've determined above.

Situation 1:

The best workaround is to specify the /dev/urandom device as the preferred entropy gathering daemon. To do this, follow these steps:

  1. Bitbucket Server 5.0+ ...

    Open <Bitbucket_Installation_Directory>/bin/_start-webapp.sh in an editor, where <Bitbucket_Installation_Directory> refers to the directory where Bitbucket Server is installed, for instance /opt/atlassian/bitbucket/5.0.0

    Up to Bitbucket Server 4.14 ...

    Open <Bitbucket_Installation_Directory>/bin/setenv.sh in an editor, where <Bitbucket_Installation_Directory> refers to the directory where Bitbucket Server is installed, for instance /opt/atlassian/bitbucket/4.6.0

  2. Locate the line starting with JVM_SUPPORT_RECOMMENDED_ARGS
  3. Within the double quotes on that line add the following value: -Djava.security.egd=file:/dev/./urandom
    After this the line should look similar to this:

    #
    # Occasionally Atlassian Support may recommend that you set some specific JVM arguments.  You can use this variable
    # below to do that.
    #
    JVM_SUPPORT_RECOMMENDED_ARGS="-Djava.security.egd=file:/dev/./urandom"

    Bitbucket Server 5.0+ では setenv と環境変数に変更があります

    Bitbucket Server 5.0 以降では setenv.shsetenv.bat が取り除かれています。これらのファイルで設定されていたオプションは、環境変数で設定できるようになりました。環境変数の設定場所は、実行先のオペレーティング システムに応じます。

    Linux

    When using the atlbitbucket service on Linux, the environment variables are ignored. You must set the parameters in _start-webapp.sh (or start-bitbucket.sh). These values will be read when the service starts.

    たとえば、 JVM_SUPPORT_RECOMMENDED_ARGS を設定するには、ファイルに次の行を追加します。

    JVM_SUPPORT_RECOMMENDED_ARGS=-XX:+HeapDumpOnOutOfMemoryError

    Windows

    Bitbucket Server を実行しているユーザーで、パラメーターを環境変数として設定します。たとえば、JVM_SUPPORT_RECOMMENDED_ARGS を設定したい場合、それを環境変数として作成して適切な値を割り当てます。Bitbucket Server がスタートアップ スクリプトやサービスを利用して起動する際に、この値が取得および適用されます。

  4. Save the file and close it
  5. Restart Bitbucket Server

If running Bitbucket Server on a virtual machine which lacks entropy, you may consider installing haveged to generate more entropy for your system.

This is a workaround. For a permanent solution you should try to determine why your system has insufficient entropy when Bitbucket Server is launched.

Situation 2:

To resolve this problem you should clear the Bitbucket Server plugin cache, which will cause Bitbucket Server to rebuild plugin cache from scratch next time it starts. Here's how to clean the plugin cache:

  1. Stop Bitbucket Server
  2. Delete the following directories (where <Bitbucket_Home_Directory> refers to the Bitbucket home directory, for instance /var/atlassian/application-data/bitbucket:
    1. <Bitbucket_Home_Directory>/plugins/.bundled-plugins
    2. <Bitbucket_Home_Directory>/plugins/.osgi-cache
  3. Start Bitbucket Server

Situation 3:

Remove the offending Java option and restart the Bitbucket Server service.

 

最終更新日 2017 年 5 月 4 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.