Bitbucket fails to start with error required plugin has failed to start after upgrade
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Problem
After upgrading Bitbucket, the application displays the following error message in the web browser:
A fatal error has occurred
The following problems occurred which prevents Bitbucket Server from starting correctly:
Required plugin com.atlassian.bitbucket.bitbucket-jira-integration has failed to start
Required plugin com.atlassian.crowd.embedded.admin has failed to start
Required plugin com.atlassian.bitbucket.bitbucket-rest-common has failed to start
Required plugin com.atlassian.bitbucket.bitbucket-rest has failed to start
Required plugin com.atlassian.applinks.applinks-plugin has failed to start
Required plugin com.atlassian.upm.atlassian-universal-plugin-manager-plugin has failed to start
Required plugin com.atlassian.bitbucket.bitbucket-stp-integration has failed to start
Required plugin com.atlassian.oauth.serviceprovider has failed to start
Required plugin com.atlassian.bitbucket.bitbucket-scm-git has failed to start
Required plugin com.atlassian.oauth.admin has failed to start
Required plugin com.atlassian.plugins.rest.atlassian-rest-module has failed to start
Resolution
Entry #1 and #3 (see Diagnostics below)
- Stop Bitbucket Service
- Backup and remove the following directories. They will be rebuilt when Bitbucket starts again.
$BITBUCKET_HOME/plugins/.bundled-plugins/
$BITBUCKET_HOME/plugins/.osgi-cache/
- Restart Bitbucket Server.
Upon starting up, Bitbucket will re-extract the required plugins from <Bitbucket installation directory>/atlassian-bitbucket/WEB-INF/classes/bundled-plugins.zip
and rebuild those plugin directories.
Entry #2:
Refer to the Supported platforms page for the minimum CPU and Memory requirements and to the Memory/CPU budgeting page for further details.
Diagnostics
One of the following information is logged to atlassian-bitbucket.log:
Entry #1:
ERROR [localhost-startStop-1] c.a.p.loaders.ScanningPluginLoader Unable to deploy plugin 'com.atlassian.plugins.rest.atlassian-rest-module' from 'Unit: /opt/bitbucket/bitbucket.norganna.org/plugins/.bundled-plugins/atlassian-rest-module-2.8.0-m7.jar (1374748504000)'.
ERROR [localhost-startStop-1] c.a.p.loaders.ScanningPluginLoader Because of the following exception:
java.lang.IllegalArgumentException: File must be a jar: /opt/bitbucket/bitbucket.test.instance.org/plugins/.osgi-cache/transformed-plugins/atlassian-rest-module-2.8.0-m7_1374748504000.jar
...
Caused by: java.util.zip.ZipException: error in opening zip file
Entry #2:
WARN [Spring DM Context Creation Timer] o.e.g.b.e.i.d.s.DependencyWaiterApplicationContextExecutor Timeout occurred before finding service dependencies for [NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.applinks.applinks-oauth-plugin, config=osgibundle:/META-INF/spring/*.xml)]
...
ERROR [Spring DM Context Creation Timer] c.a.plugin.osgi.factory.OsgiPlugin Unable to start the plugin container for plugin 'com.atlassian.applinks.applinks-oauth-plugin'
org.springframework.context.ApplicationContextException: Application context initialization for 'com.atlassian.applinks.applinks-oauth-plugin' has timed out waiting for (|(objectClass=com.atlassian.applinks.spi.auth.AuthenticationConfigurationManager)(objectClass=com.atlassian.applinks.spi.link.MutatingApplicationLinkService)(objectClass=com.atlassian.applinks.core.InternalTypeAccessor)(objectClass=com.atlassian.applinks.spi.manifest.ManifestRetriever))
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.timeout(DependencyWaiterApplicationContextExecutor.java:489) ~[na:na]
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.access$000(DependencyWaiterApplicationContextExecutor.java:54) ~[na:na]
...
ERROR [Spring DM Context Creation Timer] o.e.g.b.e.i.s.ExtenderConfiguration Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.applinks.applinks-oauth-plugin, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.context.ApplicationContextException: Application context initialization for 'com.atlassian.applinks.applinks-oauth-plugin' has timed out waiting for (|(objectClass=com.atlassian.applinks.spi.auth.AuthenticationConfigurationManager)(objectClass=com.atlassian.applinks.spi.link.MutatingApplicationLinkService)(objectClass=com.atlassian.applinks.core.InternalTypeAccessor)(objectClass=com.atlassian.applinks.spi.manifest.ManifestRetriever))
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.timeout(DependencyWaiterApplicationContextExecutor.java:489) [gemini-blueprint-extender-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002]
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.access$000(DependencyWaiterApplicationContextExecutor.java:54) [gemini-blueprint-extender-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002]
Entry #3:
2022-10-31 13:12:02,197 ERROR [AtlassianEvent::thread-22] c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.bitbucket.event.pull.PullRequestActivityEvent[source=com.atlassian.stash.internal.pull.InternalPullRequestParticipantHelper@2b6ff13b]' for the invoker 'SingleParameterMethodListenerInvoker{method=public void com.sourcegraph.webhook.WebhookListener.onPullRequestEvent(com.atlassian.bitbucket.event.pull.PullRequestEvent), listener=com.sourcegraph.webhook.WebhookListener@314f4fc3} (monitored)'
java.lang.RuntimeException: Could not initialize class com.atlassian.bitbucket.rest.pull.RestPullRequestActivity. Listener: com.sourcegraph.webhook.WebhookListener event: com.atlassian.bitbucket.event.pull.PullRequestActivityEvent
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:57)
at com.atlassian.diagnostics.internal.platform.event.EventSystemMonitor.invokeMonitored(EventSystemMonitor.java:109)
at com.atlassian.diagnostics.internal.platform.event.MonitoredListenerInvoker.invoke(MonitoredListenerInvoker.java:38)
at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:111)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37)
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at com.atlassian.stash.internal.event.EventThreadFactory.lambda$createThread$0(EventThreadFactory.java:35)
at java.base/java.lang.Thread.run(Thread.java:829)
... 1 frame trimmed
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.atlassian.bitbucket.rest.pull.RestPullRequestActivity
at jdk.internal.reflect.GeneratedConstructorAccessor777.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at com.atlassian.stash.internal.rest.renderer.DefaultSurrogateBuilder.buildFor(DefaultSurrogateBuilder.java:34)
at com.atlassian.stash.internal.rest.renderer.AggregateBuilder.buildFor(AggregateBuilder.java:73)
at com.atlassian.stash.internal.rest.renderer.BaseSurrogateJsonRenderer.render(BaseSurrogateJsonRenderer.java:56)
at com.atlassian.stash.internal.json.PluginJsonRenderer.render(PluginJsonRenderer.java:45)
at jdk.internal.reflect.GeneratedMethodAccessor1232.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at jdk.internal.reflect.GeneratedMethodAccessor1232.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at com.sourcegraph.webhook.EventSerializer.render(EventSerializer.java:42)
at com.sourcegraph.webhook.EventSerializer.buildPullRequestActivityEvent(EventSerializer.java:128)
at com.sourcegraph.webhook.EventSerializer.serialize(EventSerializer.java:99)
at com.sourcegraph.webhook.Dispatcher.<init>(Dispatcher.java:52)
at com.sourcegraph.webhook.Dispatcher.dispatch(Dispatcher.java:106)
at com.sourcegraph.webhook.WebhookListener.lambda$handle$0(WebhookListener.java:100)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at com.sourcegraph.webhook.WebhookListener.handle(WebhookListener.java:98)
at com.sourcegraph.webhook.WebhookListener.onPullRequestEvent(WebhookListener.java:76)
at jdk.internal.reflect.GeneratedMethodAccessor1701.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42)
... 9 common frames omitted
Cause
Entry #1 and #3
Bitbucket Server will initially extract a number of core plugins from <Bitbucket Server installation directory>/atlassian-bitbucket/WEB-INF/classes/bundled-plugins.zip
and put them into $BITBUCKET_HOME/plugins/.bundled-plugins/
and <BITBUCKET_HOME>/plugins/.osgi-cache/
. If one or more of these extracted plugins has become corrupted, Bitbucket will fail to start in the manner described above.
Entry #2:
The server running Bitbucket is not correctly sized.