Stash fails to start - The Spring WebApplicationContext could not be started - Unresolved constraint in bundle
Symptoms
When starting (or restarting Stash) after an upgrade, the application fails and the message displayed is:
The Spring WebApplicationContext could not be started
The following is logged in atlassian-stash.log
:
2014-08-12 07:00:56,123 ERROR [localhost-startStop-1] c.a.plugin.osgi.factory.OsgiPlugin Detected an error (BundleException) enabling the plugin 'com.atlassian.stash.plugin.stash-scm-cache' : Unresolved constraint in bundle com.atlassian.stash.plugin.stash-scm-cache [73]: Unable to resolve 73.0: missing requirement [73.0] package; (&(package=org.apache.commons.io)(version>=2.0.0)). This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see http://confluence.atlassian.com/x/1xy6D
2014-08-12 07:00:56,126 WARN [localhost-startStop-1] c.a.plugin.osgi.factory.OsgiPlugin Unable to enable plugin 'com.atlassian.stash.plugin.stash-scm-cache'
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.atlassian.stash.plugin.stash-scm-cache
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:445) ~[atlassian-plugins-osgi-2.13.4.jar:na]
at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:237) ~[atlassian-plugins-core-2.13.4.jar:na]
at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:114) [atlassian-plugins-core-2.13.4.jar:na]
at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:99) [atlassian-plugins-core-2.13.4.jar:na]
at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:725) [atlassian-plugins-core-2.13.4.jar:na]
at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:178) [atlassian-plugins-core-2.13.4.jar:na]
at com.atlassian.stash.internal.plugin.CorePluginManager.onApplicationEvent(CorePluginManager.java:45) [stash-platform-2.4.2.jar:na]
at com.atlassian.stash.internal.plugin.CorePluginManager.onApplicationEvent(CorePluginManager.java:16) [stash-platform-2.4.2.jar:na]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at com.atlassian.johnson.spring.web.context.JohnsonContextLoaderListener.initWebApplicationContext(JohnsonContextLoaderListener.java:102) [atlassian-johnson-spring-2.1.0.jar:na]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) [catalina.jar:7.0.40]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381) [catalina.jar:7.0.40]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.40]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.40]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.40]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_33]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_33]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_33]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_33]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_33]
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.atlassian.stash.plugin.stash-scm-cache [73]: Unable to resolve 73.0: missing requirement [73.0] package; (&(package=org.apache.commons.io)(version>=2.0.0))
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3409) ~[org.apache.felix.framework-3.0.2.jar:na]
at org.apache.felix.framework.Felix.startBundle(Felix.java:1709) ~[org.apache.felix.framework-3.0.2.jar:na]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905) ~[org.apache.felix.framework-3.0.2.jar:na]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892) ~[org.apache.felix.framework-3.0.2.jar:na]
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:417) ~[atlassian-plugins-osgi-2.13.4.jar:na]
... 25 common frames omitted
Cause
Stash will intially extract a number of core plugins from <Stash installation directory>/atlassian-stash/WEB-INF/classes/bundled-plugins.zip
and put them into $STASH_HOME/plugins/.bundled-plugins/
and <STASH_HOME>/plugins/.osgi-cache/
. If one or more of these extracted plugins has become corrupt Stash will fail to start in the manner described above.
Resolution
- Shut Stash down.
- Backup and remove the following directories. They will be rebuilt when Stash starts again.
$STASH_HOME
/plugins/.bundled-plugins/$STASH_HOME
/plugins/.osgi-cache/
- Restart Stash.