Bamboo remote agent cannot connect to server with error "java.lang.IllegalArgumentException: Invalid connect parameters"
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
Bamboo remote agent fails to connect to Bamboo server with an error stating javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters
Diagnosis
The remote agent never registers as online on the Bamboo Server and the $BAMBOO_AGENT_HOME/atlassian-bamboo-agent.log
contains an error similar to the below:
2021-06-06 09:14:55,397 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.JMSException: Error while attempting to add new Connection to the pool
...
2021-06-06 09:14:55,489 FATAL [AgentRunnerThread] [AgentBootstrap] Exiting due to fatal exception.
...
<stack trace>
Caused by: javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {amp;maxReconnectAttempts=10}
Cause
There is a typo or misconfiguration in the Broker client URL defined on the Bamboo Server side (it is propagated to agents when they connect) at:
- Bamboo Administration >> Overview >> General configuration >> Broker client URL
$BAMBOO_HOME/bamboo.cfg.xml
<property name="bamboo.jms.broker.client.uri">...</property>
There can be many types of misconfiguration/typos that can cause the Invalid connect parameters error.
In this particular example, a typo causing the ampersand not to be escaped:
<property name="bamboo.jms.broker.client.uri">failover:(tcp://hostname:54663?wireFormat.maxInactivityDuration=300000)?initialReconnectDelay=15000amp;maxReconnectAttempts=10</property>
See the solution below on how to correctly escape an ampersand in XML.
Solution
Since there can be any number of misconfigurations or typo in the string that cause the Invalid connect parameters error, you should inspect the string and see if you can identify it. Otherwise, consider going back to a known good default. Example:
<property name="bamboo.jms.broker.client.uri">failover:(tcp://hostname:54663?wireFormat.maxInactivityDuration=300000)?initialReconnectDelay=15000&maxReconnectAttempts=10</property>
Any changes to the Broker URLs will require the Bamboo Server to be restarted for the change to apply, not just the agent.