Bamboo remote agent fails to start - javax.servlet.ServletContext
This KB article is not relevant to any version of Bamboo currently supported. If this fits your current installation, please consider upgrading Bamboo
Symptoms
Installing a remote agent fails with this:
INFO | jvm 2 | 2012/07/03 17:40:48 | 2012-07-03 17:40:48,158 FATAL [Thread-1] [AgentBootstrap] Exiting due to fatal exception.
INFO | jvm 2 | 2012/07/03 17:40:48 | java.lang.reflect.InvocationTargetException
INFO | jvm 2 | 2012/07/03 17:40:48 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 2 | 2012/07/03 17:40:48 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
INFO | jvm 2 | 2012/07/03 17:40:48 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.reflect.Method.invoke(Method.java:597)
INFO | jvm 2 | 2012/07/03 17:40:48 | at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:41)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.Thread.run(Thread.java:662)
INFO | jvm 2 | 2012/07/03 17:40:48 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeLocator' defined in class path resource [applicationContextRemoteAgent.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:88)
INFO | jvm 2 | 2012/07/03 17:40:48 | at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.initApplicationContext(RemoteAgent.java:160)
INFO | jvm 2 | 2012/07/03 17:40:48 | at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.start(RemoteAgent.java:53)
INFO | jvm 2 | 2012/07/03 17:40:48 | ... 6 more
INFO | jvm 2 | 2012/07/03 17:40:48 | Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.Class.getDeclaredMethods0(Native Method)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.Class.privateGetPublicMethods(Class.java:2547)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.Class.getMethods(Class.java:1410)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1284)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1158)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.beans.Introspector.getBeanInfo(Introspector.java:408)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.beans.Introspector.getBeanInfo(Introspector.java:167)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:244)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:236)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:194)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:177)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.BeanWrapperImpl.<init>(BeanWrapperImpl.java:130)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:753)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
INFO | jvm 2 | 2012/07/03 17:40:48 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
INFO | jvm 2 | 2012/07/03 17:40:48 | ... 16 more
INFO | jvm 2 | 2012/07/03 17:40:48 | Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
INFO | jvm 2 | 2012/07/03 17:40:48 | at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
INFO | jvm 2 | 2012/07/03 17:40:48 | ... 33 more
Cause
javax.servlet-2.5.0.v...jar file is missing; you might have removed javax.servlet-2.5.0.v...jar file from BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/lib directory (maybe for trying to run Bamboo on Tomcat).
Resolution
Every time a remote agent fails to start, you should check if you are using the same hostname or IP address for your Bamboo Base URL (Administartion -> General Configuration tab) and for your Broker URI in BAMBOO_HOME/bamboo.cfg.xml file:
<property name="bamboo.jms.broker.client.uri">failover:(tcp://URL_GOES_HERE:54663?wireFormat.maxInactivityDuration=300000)?maxReconnectAttempts=10&initialReconnectDelay=15000</property>
<property name="bamboo.jms.broker.uri">tcp://0.0.0.0:54663?wireFormat.maxInactivityDuration=300000</property>
After, please check if the javax.servlet-2.5...jar exists in the BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/lib directory. If it doesn't, then feel free to download the same version of a stand alone Bamboo again, extract the files from the downloaded archive file, and copy the needed file to BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/lib directory.
Another possibility could be that you are using an unsupported version of Tomcat. Note that tomcat 7 is still not supported yet