Remote agent crashes when started as Windows service

Hi, I am having some trouble starting an agent in Windows 7 x64, Java 7.67 (agent 5.4.1, by the way)

Attempted to reinstall, it finishes with no errors. However, when I start the agent from the Windows Services panel, I see the following in the log file:

INFO | jvm 1 | 2015/04/03 09:39:20 | 2015-04-03 09:39:20,105 INFO [Thread-1] [BambooActiveMQConnectionFactory] Broker URI: tcp://build.*******.lan:54663?wireFormat.maxInactivityDuration=300000 is valid.
INFO | jvm 1 | 2015/04/03 09:39:21 | 2015-04-03 09:39:20,985 ERROR [Thread-1] [EventPublisherImpl] There was an exception thrown trying to dispatch event 'com.atlassian.plugin.event.events.PluginFrameworkStartingEvent@2ea57165' from the invoker 'com.atlassian.plugin.event.impl.MethodSelectorListenerHandler$1$1@2fe8579e'.
INFO   | jvm 1    | 2015/04/03 09:39:21 | java.lang.RuntimeException: java.util.ArrayList cannot be cast to [Ljava.lang.Class;
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.event.impl.MethodSelectorListenerHandler$1$1.invoke(MethodSelectorListenerHandler.java:67)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2$1.run(AsynchronousAbleEventDispatcher.java:44)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1.execute(AsynchronousAbleEventDispatcher.java:29)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:90)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:151)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:70)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.event.impl.DefaultPluginEventManager.broadcast(DefaultPluginEventManager.java:84)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:149)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1237)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1095)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:88)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.initApplicationContext(RemoteAgent.java:160)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.start(RemoteAgent.java:53)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:28)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | Caused by: java.lang.reflect.InvocationTargetException
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.event.impl.MethodSelectorListenerHandler$1$1.invoke(MethodSelectorListenerHandler.java:49)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	... 40 more
INFO   | jvm 1    | 2015/04/03 09:39:21 | Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Ljava.lang.Class;
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.spring.SpringHostComponentProviderFactoryBean$SpringHostComponentProvider.provideBeans(SpringHostComponentProviderFactoryBean.java:153)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.spring.SpringHostComponentProviderFactoryBean$SpringHostComponentProvider.provide(SpringHostComponentProviderFactoryBean.java:122)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager.collectHostComponents(FelixOsgiContainerManager.java:482)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager.start(FelixOsgiContainerManager.java:241)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	at com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager.onStart(FelixOsgiContainerManager.java:203)
INFO   | jvm 1    | 2015/04/03 09:39:21 | 	... 45 more

And then it continues failing to load plugins:

C:\bamboo\agent0\plugins\system-provided\bamboo-tomcat-plugin-5.0.2.jar (1393280120984)
INFO   | jvm 1    | 2015/04/03 09:39:21 | java.lang.IllegalStateException: Unable to create a tracker when osgi is not running
...
INFO   | jvm 1    | 2015/04/03 09:39:21 | 2015-04-03 09:39:21,886 ERROR [Thread-1] [ScanningPluginLoader] Unable to deploy plugin 'com.atlassian.bamboo.plugins.maven', file Unit: C:\bamboo\agent0\plugins\system-provided\atlassian-bamboo-plugin-maven-5.4.1.jar (1393453012808)
INFO   | jvm 1    | 2015/04/03 09:39:21 | java.lang.IllegalStateException: Unable to create a tracker when osgi is not running

The same thing happens if I run StartBambooAgent-NT.bat from the bin directory. However, the agent does run if I use BambooAgent.bat. It seems to me that the initial exception is bringing the agent down:

INFO   | jvm 1    | 2015/04/03 09:39:21 | 2015-04-03 09:39:20,985 ERROR [Thread-1] [EventPublisherImpl] There was an exception thrown trying to dispatch event 'com.atlassian.plugin.event.events.PluginFrameworkStartingEvent@2ea57165' from the invoker 'com.atlassian.plugin.event.impl.MethodSelectorListenerHandler$1$1@2fe8579e'.

 

What is going on here? Firewall/antivirus issues or Java?

1 answer

1 accepted

Hi Andrey,

It looks like as a service your agent uses Java 8. Please check this idea.

Thanks for the suggestion. I updated to 8.40, made sure my JAVA_PATH variable was pointing to the new version, tried running the service under my username, and it still crashes. I might try an install in a different directory.

@Andrey The point is that your Bamboo doesn't support Java 8. Use Java 7 or update your Bamboo.

Spot on Sergey! Somehow a new 1.8 JDK got added during a bout of updates and there was no explicit JAVA_HOME set for this user.

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,068 views 0 5
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