Spring error using Atlassian SDK to run local instance of Stash with atlas-run-standalone

I am able to run a local instance of jira, with this command:

atlas-run-standalone --product jira

and when I visit "http://localhost:2990/jira", it works fine, i.e. I am redirected to the "http://localhost:2990/jira/secure/Dashboard.jspa" URL and presented with a login screen.

Likewise, I am able to run confluence succesfully.

However, when run

atlas-run-standalone --product stash

I see errors about the Spring framework in the console, in particular, it hangs for about 30 seconds on this line:

[INFO] [talledLocalContainer] INFO: Initializing Spring root WebApplicationContext

then emits this stack trace:

[INFO] [talledLocalContainer] Exception in thread "Spring executor 2" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handler' defined in URL [bundle://26.0:0/META-INF/spring/web-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
[INFO] [talledLocalContainer] 	at java.security.AccessController.doPrivileged(Native Method)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
[INFO] [talledLocalContainer] 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
[INFO] [talledLocalContainer] 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
[INFO] [talledLocalContainer] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
[INFO] [talledLocalContainer] 	at java.lang.Thread.run(Thread.java:662)
[INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
[INFO] [talledLocalContainer] 	at java.lang.Class.getDeclaredMethods0(Native Method)
[INFO] [talledLocalContainer] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
[INFO] [talledLocalContainer] 	at java.lang.Class.privateGetPublicMethods(Class.java:2556)
[INFO] [talledLocalContainer] 	at java.lang.Class.getMethods(Class.java:1412)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1284)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1158)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:408)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:220)
[INFO] [talledLocalContainer] 	at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:282)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:333)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1247)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
[INFO] [talledLocalContainer] 	... 18 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
[INFO] [talledLocalContainer] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] [talledLocalContainer] 	... 43 more
[INFO] [talledLocalContainer] Exception in thread "Spring executor 5" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handler' defined in URL [bundle://23.0:0/META-INF/spring/web-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
[INFO] [talledLocalContainer] 	at java.security.AccessController.doPrivileged(Native Method)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
[INFO] [talledLocalContainer] 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
[INFO] [talledLocalContainer] 	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
[INFO] [talledLocalContainer] 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
[INFO] [talledLocalContainer] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
[INFO] [talledLocalContainer] 	at java.lang.Thread.run(Thread.java:662)
[INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
[INFO] [talledLocalContainer] 	at java.lang.Class.getDeclaredMethods0(Native Method)
[INFO] [talledLocalContainer] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
[INFO] [talledLocalContainer] 	at java.lang.Class.privateGetPublicMethods(Class.java:2556)
[INFO] [talledLocalContainer] 	at java.lang.Class.getMethods(Class.java:1412)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1284)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1158)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:408)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.<init>(Introspector.java:389)
[INFO] [talledLocalContainer] 	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
[INFO] [talledLocalContainer] 	at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:220)
[INFO] [talledLocalContainer] 	at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:282)
[INFO] [talledLocalContainer] 	at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:333)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1247)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
[INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
[INFO] [talledLocalContainer] 	... 18 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
[INFO] [talledLocalContainer] 	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
[INFO] [talledLocalContainer] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] [talledLocalContainer] 	... 43 more

and when I visit "http://localhost:7990/stash", I see the following error message:

A fatal error has occurred

The following problems occurred which prevents Atlassian Stash from starting correctly:

  • Required plugin com.atlassian.crowd.embedded.admin has failed to start
  • Required plugin com.atlassian.activeobjects.activeobjects-plugin has failed to start

I have tested this both on a 32-bit Ubuntu 12.04 machine and a 64-bit Ubuntu 12.10 machine with identical results, and I have tried with both jdk1.6.0_43 and jdk1.7.0_17 with identical results.

1 answer

1 accepted

1 vote

Hi Carl,

The problem is that atlas-run-standalone is starting up Tomcat 6, while Stash requires Tomcat 7. This has been fixed in the latest version of the Atlassian Plugin SDK. If you upgrade the SDK everything should work as expected. Alternatively, you can specify the container id in your pom.xml as follows:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-stash-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <products>
            <product>
                <id>stash</id>
                <instanceId>stash</instanceId>
                <version>....</version>
                <dataVersion>....</dataVersion>
                <containerId>tomcat7x</containerId>
            </product>
        </products>
    </configuration>
</plugin>

Thanks. It seems then, that the "atlassian-plugin-sdk" Ubuntu package is not the latest version. I had followed the installation instructions for Ubuntu here:

https://developer.atlassian.com/display/DOCS/Install+the+Atlassian+SDK+on+a+Linux+or+Mac+System

What version of the SDK are you running? You can run atlas-version to find out. The latest version is 4.1.6.

Thanks Karl,

I'll try to reproduce it using atlas-run-standalone and fix the SDK when I do. For now you can add --container tomcat7x to atlas-run-standalone to force it to use tomcat 7.

Full documentation is here: https://developer.atlassian.com/display/DOCS/atlas-run-standalone

Cheers,

Michael

I am indeed running version 4.1.6. Regarding the other solution you suggested--modifying the pom.xml--I haven't started a plugin project yet. I have only run "atlas-run-standalone --product stash". Is there some pom.xml file in the raw SDK installation that I can modify to fix this problem?

I just just tried the new invocation

atlas-run-standalone --product stash --container tomcat7x

The same error was produced, though the console output does contain a line,

Tomcat 7.x starting...

In fact, I see the Tomcat 7 starting message even when I omit the "--container tomcat7x" argument.

I haven't been able to reproduce it locally. Could it be that you've run atlas-run-standalone from the current directory with an older version of stash (before 2.0)? It may be that the amps-run-standalone directory already contains an unpacked version of Tomcat6. Try running atlas-run-standalone from an empty directory to be sure.

I did try from an empty directory. Here is the complete console output, including the entire startup and shutdown sequence:

http://pastebin.com/6fsecN8R

Next, I will try re-installing in a pristine, stock Ubuntu 12.10 VM.

From your pastebin it appears that atlas-run-standalone is downloading an old beta version of Stash (1.3.0-beta2).

Please try the following:

atlas-run-standalone --product stash --version 2.2.0 --data-version 2.2.0

That should force it to download the latest stable version. Make sure you run it from a clean directory to be safe.

That worked, thanks. One other important thing was that I had to use ".bashrc" to set my $JAVA_HOME variable. In this documentation, there are inconsistent references to both ".bashrc" and ".bash_profile":

https://developer.atlassian.com/display/DOCS/Set+up+the+SDK+Prerequisites+for+Linux+or+Mac

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

714 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot