Unable to validate JMS Broker Client URI when running remote Bamboo agent
Asked by Maksym Grebenets:

Hi all.

I'm facing a problem running Bamboo remote agent.  
Here's my setup:  
Bamboo server: Bamboo 5.3, Mac OS X 10.8, Java version 1.6.0_65  
The broker uris are all set properly

```
&lt;property name="bamboo.jms.broker.uri"&gt;tcp://0.0.0.0:54663?wireFormat.maxInactivityDuration=300000&lt;/property&gt;&lt;property name="bamboo.jms.broker.client.uri"&gt;failover:(tcp://10.68.77.7:54663?wireFormat.maxInactivityDuration=300000)?maxReconnectAttempts=10&amp;amp;initialReconnectDelay=15000&lt;/property&gt;
```

<br />

Bamboo agent: Mac OS X 10.9.  
On client Mac I tried to run both with and without the wrapper with same results.  
Here's an example of the script I use to start agent:

```
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)java \	-Dbamboo.Home=~/bamboo-agent-home \	-Dbamboo.agent.ignoreServerCertName=true \	-jar atlassian-bamboo-agent-installer-5.3.jar \	http://10.68.77.7:8085/agentServer/
```

Once the JAVA_HOME is set using java_home, the java version is exaclty the same as on the sever Mac  
When running the script I get the following warning message:

```
INFO   | jvm 1    | 2013/12/30 15:50:30 | 2013-12-30 15:50:30,263 INFO [Thread-2] [BambooActiveMQConnectionFactory] Setting broker URL to 'failover:(tcp://10.68.77.7:54663?wireFormat.maxInactivityDuration=300000)?maxReconnectAttempts=10&amp;initialReconnectDelay=15000'INFO   | jvm 1    | 2013/12/30 15:50:30 | 2013-12-30 15:50:30,264 WARN [Thread-2] [BambooActiveMQConnectionFactory] Unable to validate failover:(tcp://10.68.77.7:54663?wireFormat.maxInactivityDuration=300000)?maxReconnectAttempts=10&amp;initialReconnectDelay=15000: java.net.URISyntaxException: Illegal character in scheme name at index 0: 10.68.77.7:54663?wireFormat.maxInactivityDuration=300000
```

And there's no new remote agent in the Agents page of Bamboo admin settings, though I can see log message like this

```
Dec 30, 2013 3:39:34 PM A remote agent is loading on 10.68.75.100 (10.68.5.2).Dec 30, 2013 3:50:08 PM A remote agent is loading on 10.68.75.100 (10.68.5.2).Dec 30, 2013 3:52:08 PM A remote agent is loading on 10.68.75.100 (10.68.5.2).
```

I tried various approaches, putting "//" after "failover:" dropping "failover:" completely and many more, but I either get the same warning and no remote agent or get Java exceptions.


Answers:
author: Maksym Grebenets
body: Finally got it working.

In short

1. **Must** use hostname but not IP address for remote agent broker URI.
2. The hostname **must** match excatly the computer name displayed in *System Preferences \> Sharing* , also normally returned by **hostname** shell command.

For example, in *System Preferences \> Sharing*the Computer Name is "App's Mac mini", the message below says

```
Computers on your local network can access your computer at: Apps-Mac-mini.local
```

The **hostname**when ran in terminal returns "Apps-Mac-mini.local".

So the broker URI is:

```
failover:(tcp://apps-mac-mini.local:54663?wireFormat.maxInactivityDuration=300000)?initialReconnectDelay=15000&amp;maxReconnectAttempts=10
```

This is the support ticket I opened, I posted this answer there as well.  
[](https://support.atlassian.com/browse/BSP-12372)<https://support.atlassian.com/browse/BSP-12372>


author: Przemek Bruski
body: I think it's best if you contacted support.


author: Przemek Bruski
body: These two issues (validation and remote agent) are unrelated. The reason for the validation warning is that it does not parse IP-based URL correctly. This has no consequences on agent loading.

Is that address (10.68.77.7:54663) reachable from your agent?

comments: author: Maksym Grebenets
body: Yes, it is.  
Before the validation fails, there's lots of communication from client to server (10.68.77.7).  
For example, the following command works fine (75.100 is the client machine IP, from which I try to run the agent):

```
curl -D - http://10.68.77.7:8085/agentServer/GetFingerprint.action?hostName=10.68.75.100--- output ---HTTP/1.1 200 OKVia: 1.1 NWNSHSISA02Connection: Keep-AliveProxy-Connection: Keep-AliveTransfer-Encoding: chunkedDate: Mon, 30 Dec 2013 22:03:37 GMTContent-Type: text/plain;charset=UTF-8Server: Apache-Coyote/1.1Set-Cookie: JSESSIONID=76264BEE258D931852CB62D9C6A24C6B; Path=/; HttpOnlyContent-Language: en-USbootstrapVersion=1&amp;fingerprint=6001176615652131794&amp;agentClassName=com.atlassian.bamboo.v2.build.agent.remote.UpgradeRemoteAgent&amp;userProperty.bamboo.agent.brokerUrl=failover%3A%28tcp%3A%2F%2F10.68.77.7%3A54663%3FwireFormat.maxInactivityDuration%3D300000%29%3FmaxReconnectAttempts%3D10%26initialReconnectDelay%3D15000&amp;userProperty.bamboo.agent.heartbeatInterval=60
```

The port is open as well on the server machine.

```
# .../Utilities/Network Utility.app/Contents/Resources$ ./stroke 10.68.77.7 54663 54663Port Scanning host: 10.68.77.7	 Open TCP Port: 	54663
```

```

```

```
UPD
```

```
If it matters, there's a number of other WARN's in the log
```

```
INFO   | jvm 4    | 2013/12/31 07:18:56 | 2013-12-31 07:18:56,106 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 existINFO   | jvm 4    | 2013/12/31 07:18:56 | 2013-12-31 07:18:56,142 DEBUG [Thread-2] [RemoteAgentHomeLocatorForBootstrap] Trying to load bamboo-init.properties from properties file...INFO   | jvm 4    | 2013/12/31 07:18:56 | 2013-12-31 07:18:56,142 DEBUG [Thread-2] [RemoteAgentHomeLocatorForBootstrap] Could not find bamboo.home property in the bamboo-init.properties file. trying other methods.
```

```

```


author: Daniel Wester
body: Make sure that you can access port 54663 from the agent machine. Usually when I've seen this behavior there's a firewall in between the machines. Can you do a telnet to the bamboo server from the machine running the agent on port 54663?


author: Maksym Grebenets
body: I tried telnet just now.  
It looks fine as far as I can tell.

```
$ telnet 10.68.77.7 54663Trying 10.68.77.7...Connected to nap-ci.Escape character is '^]'.?ActiveMQ?        MaxFrameSize???	CacheSize                                         CacheEnabledSizePrefixDisabled MaxInactivityDurationInitalDelay'TcpNoDelayEnabledMaxInactivityDuration??TightEncodingEnabledStackTraceEnabled
```

Is this output normal or should I try to configure another "safer" port number?


author: Przemek Bruski
body: The output is correct.


author: Maksym Grebenets
body: Here's another piece of log that might be important, this message is displayed at the very start

```
INFO   | jvm 1    | 2014/01/06 09:55:13 | WARNING - The Wrapper jar file currently in use is version "3.2.3-atlassian-1"INFO   | jvm 1    | 2014/01/06 09:55:13 |           while the version of the Wrapper which launched this JVM isINFO   | jvm 1    | 2014/01/06 09:55:13 |           "3.2.3.1".INFO   | jvm 1    | 2014/01/06 09:55:13 |           The Wrapper may appear to work correctly but some features mayINFO   | jvm 1    | 2014/01/06 09:55:13 |           not function correctly.  This configuration has not been testedINFO   | jvm 1    | 2014/01/06 09:55:13 |           and is not supported.
```

I will google around and see how to specify another wrapper, but if you know already, I'd appreciate a hint, thanks.

**UPD**

Actually, I don't think it matters. When I try to launch an agent without wrapper, I still have the same WARNs in the log. I can see an agent requesting authentication (after I enabled remote agent authentication, I can see a message saying "remote agent is loading on ...", but no agent itselt).

Here's how I launch an agent with no wrapper

```
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)java -versionjava -Dhttp.proxyHost=127.0.0.1 \	-Dhttp.proxyPort=8099 \	-Dbamboo.Home=~/bamboo-agent-home \	-Dbamboo.agent.ignoreServerCertName=true \	-jar bamboo-agent-5.3.jar \	http://10.68.77.7:8085/agentServer/
```


Tags: bamboo-administration