Bamboo ondemand agent stuck on pending state
Asked by joji_johny:

Hi,

I created a custom elastic image in AWS and started the instance from Bamboo Ondemand. The instance starts up, however the elastic-agent status is always "Pending". Looking at the logs, it is clear that the there is some issue with the file "bamboo-agent.cfg.xml". However this file is empty in the AWS instance.

The log file says:

\[Fatal Error\] :-1:-1: Premature end of file. Exiting due to fatal exception.

Please help....

Complete log is below:

```
2014-07-02 09:11:44,024 INFO [Thread-2] [RemoteAgent] Starting application context...2014-07-02 09:11:47,995 WARN [Thread-2] [PropertyPlaceholderConfigurer] Could not load properties from class path resource [bamboo-init.properties]: class path resource [bamboo-init.properties] cannot be opened because it does not exist2014-07-02 09:11:48,041 INFO [Thread-2] [RemoteAgentHomeLocatorForBootstrap] Agent home located at '/home/bamboo/bamboo-agent-home'2014-07-02 09:11:48,041 INFO [Thread-2] [RemoteAgentHomeDirectoryLayout] Plugin directory: /home/bamboo/bamboo-agent-home/plugins2014-07-02 09:11:48,042 INFO [Thread-2] [RemoteAgentHomeDirectoryLayout] Plugin cache directory: /home/bamboo/bamboo-agent-home/caches/plugins[Fatal Error] :-1:-1: Premature end of file.Exiting due to fatal exception.java.lang.reflect.InvocationTargetException        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:606)        at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:28)        at java.lang.Thread.run(Thread.java:744)Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentConfiguration' defined in class path resource [applicationContextRemoteAgent.xml]: Invocation of init method failed; nested exception is com.atlassian.bamboo.configuration.ConfigurationException: Could not load configuration file bamboo-agent.cfg.xml from /home/bamboo/bamboo-agent-home        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1170)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)        at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:122)        at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:88)        at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.initApplicationContext(RemoteAgent.java:160)        at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.start(RemoteAgent.java:53)        at com.atlassian.bamboo.agent.elastic.client.ElasticAgent.start(ElasticAgent.java:24)        ... 6 moreCaused by: com.atlassian.bamboo.configuration.ConfigurationException: Could not load configuration file bamboo-agent.cfg.xml from /home/bamboo/bamboo-agent-home        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.initConfiguration(AgentConfiguration.java:100)        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.init(AgentConfiguration.java:61)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:606)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1237)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)        ... 18 moreCaused by: org.apache.commons.configuration.ConfigurationException: Premature end of file.        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:673)        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:631)        at org.apache.commons.configuration.XMLConfiguration$XMLFileConfigurationDelegate.load(XMLConfiguration.java:1092)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:283)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:215)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:193)        at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(AbstractHierarchicalFileConfiguration.java:163)        at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.&lt;init&gt;(AbstractHierarchicalFileConfiguration.java:108)        at org.apache.commons.configuration.XMLConfiguration.&lt;init&gt;(XMLConfiguration.java:188)        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.initConfiguration(AgentConfiguration.java:90)        ... 26 moreCaused by: org.xml.sax.SAXParseException; Premature end of file.        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:665)        ... 35 more2014-07-02 09:11:48,121 FATAL [Thread-2] [AgentBootstrap] Exiting due to fatal exception.java.lang.reflect.InvocationTargetException        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:606)        at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:28)        at java.lang.Thread.run(Thread.java:744)Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentConfiguration' defined in class path resource [applicationContextRemoteAgent.xml]: Invocation of init method failed; nested exception is com.atlassian.bamboo.configuration.ConfigurationException: Could not load configuration file bamboo-agent.cfg.xml from /home/bamboo/bamboo-agent-home        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1170)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)        at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:122)        at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:88)        at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.initApplicationContext(RemoteAgent.java:160)        at com.atlassian.bamboo.v2.build.agent.remote.RemoteAgent.start(RemoteAgent.java:53)        at com.atlassian.bamboo.agent.elastic.client.ElasticAgent.start(ElasticAgent.java:24)        ... 6 moreCaused by: com.atlassian.bamboo.configuration.ConfigurationException: Could not load configuration file bamboo-agent.cfg.xml from /home/bamboo/bamboo-agent-home        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.initConfiguration(AgentConfiguration.java:100)        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.init(AgentConfiguration.java:61)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:606)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1237)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)        ... 18 moreCaused by: org.apache.commons.configuration.ConfigurationException: Premature end of file.        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:673)        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:631)        at org.apache.commons.configuration.XMLConfiguration$XMLFileConfigurationDelegate.load(XMLConfiguration.java:1092)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:283)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:215)        at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:193)        at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(AbstractHierarchicalFileConfiguration.java:163)        at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.&lt;init&gt;(AbstractHierarchicalFileConfiguration.java:108)        at org.apache.commons.configuration.XMLConfiguration.&lt;init&gt;(XMLConfiguration.java:188)        at com.atlassian.bamboo.v2.build.agent.remote.AgentConfiguration.initConfiguration(AgentConfiguration.java:90)        ... 26 moreCaused by: org.xml.sax.SAXParseException; Premature end of file.        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)        at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:665)        ... 35 more[root@ip-172-31-36-143 bin]#
```


Answers:
author: Dhawal Bhanushali
body: Facing same issue. So many posts for the same question. Elastic agent stuck on 'pending' status. How do I make it online? Am using bamboo onDemand? Can I log the issue?


author: Dhawal Bhanushali
body: I am stuck on the same issue. Can't log the issue since I am using Bamboo onDemand.  
Status gets stuck to pending and then the instance gets terminated.


author: cbenard1
body: Hi Joji,

One possibility here is that the user account running the Bamboo instance does not have permission to access the required config file. Could you please double check that Bamboo service is run with administrator permissions and that Bamboo user can access the config file and directory in which it's held.

If this is not your issue could you please visit [support.atlassian.com](http://support.atlassian.com)and create a support request so we can further assist you?

Thanks!

Turner

comments: author: cbenard1
body: Also it's possible that the config file has been removed. So please check that it still exists :)


Tags: cloud