Bamboo remote agent fails to start up due to UnknownHostException
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The remote agent is not able to start up and the following exception can be seen in the <bamboo-agent-home>/atlassian-bamboo-agent.log file:
INFO | jvm 1 | 2022/08/03 20:24:30 | 2022-08-03 20:24:30,623 INFO [WrapperSimpleAppMain] [RemoteAgentHttpClientFactory] Creating a new HTTP client...
INFO | jvm 1 | 2022/08/03 20:24:31 | 2022-08-03 20:24:30,998 INFO [WrapperSimpleAppMain] [AgentContext] Authenticating against Bamboo server at https://my-bamboo.net/agentServer/
INFO | jvm 1 | 2022/08/03 20:24:31 | Exiting due to fatal exception.
INFO | jvm 1 | 2022/08/03 20:24:31 | java.net.UnknownHostException: my-bamboo.net
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1330)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.InetAddress.getAllByName0(InetAddress.java:1283)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.InetAddress.getAllByName(InetAddress.java:1199)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.net.InetAddress.getAllByName(InetAddress.java:1127)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:123)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:109)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:96)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.run(RemoteAgentBootstrap.java:109)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.main(RemoteAgentBootstrap.java:56)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 1 | 2022/08/03 20:24:31 | at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:21)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | 2022/08/03 20:24:31 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 1 | 2022/08/03 20:24:31 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
INFO | jvm 1 | 2022/08/03 20:24:31 | at java.lang.Thread.run(Thread.java:750)
Or it also could fail after ' Registering agent on the server' as below after trying to reach the hostname specified in the Broker client URL.
2023-11-07 01:52:05,147 INFO [AgentRunnerThread] [AgentRegistrationBean] Registering agent on the server,
2023-11-07 01:52:05,378 WARN [ActiveMQ Task-1] [FailoverTransport] Failed to connect to [ssl://my-bamboo.net:54663?socket.verifyHostName=false&wireFormat.maxInactivityDuration=90000] after: 1 attempt(s) with my-bamboo.net, continuing to retry.
2023-11-07 01:56:20,407 ERROR [ActiveMQ Task-1] [FailoverTransport] Failed to connect to [ssl://my-bamboo.net:54663?socket.verifyHostName=false&wireFormat.maxInactivityDuration=90000] after: 10 attempt(s)
2023-11-07 01:56:20,413 INFO [ActiveMQ Connection Executor: unconnected] [PooledConnectionFactory] Expiring connection ActiveMQConnection {id=ID:bambooAgent-4444-1699321925234-1:1,clientId=ID:bambooAgent-4444-1699321925234-0:1,started=false} on IOException: my-bamboo.net
2023-11-07 01:56:20,415 WARN [AgentRunnerThread] [RemoteAgent$1] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentRegistrationBean': Invocation of init method failed; nested exception is org.springframework.remoting.RemoteAccessException: Could not access JMS invoker queue [queue://com.atlassian.bamboo.registrationQueue]; nested exception is javax.jms.IllegalStateException: javax.jms.JMSException: my-bamboo.net
2023-11-07 01:56:20,415 INFO [AgentRunnerThread] [SVNClientManagerFactory] Destroying SVNClientManagerFactories...
2023-11-07 01:56:20,416 INFO [AgentRunnerThread] [QuartzScheduler] Scheduler scheduler_$_NON_CLUSTERED shutting down.
2023-11-07 01:56:20,416 INFO [AgentRunnerThread] [QuartzScheduler] Scheduler scheduler_$_NON_CLUSTERED paused.
2023-11-07 01:56:20,417 INFO [AgentRunnerThread] [QuartzScheduler] Scheduler scheduler_$_NON_CLUSTERED shutdown complete.
2023-11-07 01:56:20,429 FATAL [AgentRunnerThread] [AgentBootstrap] Exiting due to fatal exception.
java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at com.atlassian.bamboo.agent.bootstrap.AgentRunner.run(AgentRunner.java:27) ~[bamboo-agent-bootstrap.jar:?]
at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentRegistrationBean': Invocation of init method failed; nested exception is org.springframework.remoting.RemoteAccessException: Could not access JMS invoker queue [queue://com.atlassian.bamboo.registrationQueue]; nested exception is javax.jms.IllegalStateException: javax.jms.JMSException: my-bamboo.net
... 6 more
Caused by: org.springframework.remoting.RemoteAccessException: Could not access JMS invoker queue [queue://com.atlassian.bamboo.registrationQueue]; nested exception is
... 6 more
Caused by: javax.jms.IllegalStateException: javax.jms.JMSException: my-bamboo.net
... 6 more
Caused by: java.net.UnknownHostException: my-bamboo.net
at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:572) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]
at java.net.Socket.connect(Socket.java:633) ~[?:?]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304) ~[?:?]
at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:525) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:488) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:172) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.InactivityMonitor.start(InactivityMonitor.java:52) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:1026) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:151) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133) ~[activemq-client-5.18.2.jar:5.18.2]
at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48) ~[activemq-client-5.18.2.jar:5.18.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
Environment
All Bamboo versions.
Diagnosis
The remote agent is unable to resolve Bamboo's Base URL or Broker client URL configured in the Administration → Overview → System, select General configuration.
In the example above the hostname is my-bamboo.net. Try pinging Bamboo's hostname from the server where the agent is installed. For example:
ping my-bamboo.net
- If you are able to ping Bamboo's hostname from the server where the agent is installed but the agent continues to fail with UnknownHostException check if you're using a forward proxy on that server to reach Bamboo. It may be necessary to configure the remote agent to use the forward proxy as well.
Cause
This is likely a DNS problem. If the remote agent cannot reach Bamboo because it's unable to resolve its hostname the connection between the agent and Bamboo cannot be established.
Solution
Solution 1
- Verify the configuration on Bamboo's Base URL or Broker client URL is correct.
- Update the appropriate DNS records to include the Bamboo Base URL/ address that the remote agent needs to use to connect to Bamboo.
- Restart the remote agent.
Solution 2
Update the hosts file on the server where the remote agent is running:
Operating System Location Linux /etc/hosts Windows C:\Windows\System32\drivers\etc\hosts Ensure the correct IP address and hostname the agent needs to use to connect to Bamboo are added to the file. For example:
<IP address> <hostname> 192.168.1.123 my-bamboo-net
Restart the remote agent.
Solution 3
Configure the remote agent to use a forward proxy in order to reach Bamboo by following the steps outlined on this page: