java.net.ConnectException: Connection refused at Glassfish JMS Service Connection mq


After setting up several Glassfish clusters without any mq problem, this error was new to me.


[#|2010-11-15T10:07:09.309+0100|INFO|sun-appserver2.1|javax.enterprise.resource.resourceadapter|_ThreadID=10;_ThreadName=main;|JMS Service Connection URL is :mq://YSGF02.hosting.yenlo.nl:37676/,mq://YSGF01.hosting.yenlo.nl:37676/|#]

[#|2010-11-15T10:07:09.337+0100|INFO|sun-appserver2.1|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=10;_ThreadName=main;|MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...|#]

[#|2010-11-15T10:07:09.403+0100|INFO|sun-appserver2.1|javax.resourceadapter.mqjmsra.lifecycle|_ThreadID=10;_ThreadName=main;|MQJMSRA_LB1101: Looking for Broker Running at:localhost:37676|#]

[#|2010-11-15T10:07:09.555+0100|WARNING|sun-appserver2.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=1e46e121-dc39-4df8-8717-f638ca99a1ff;|[C4003]: Error occurred on connection creation [localhost:37676]. - cause: java.net.ConnectException: Connection refused|#]

[#|2010-11-15T10:07:10.593+0100|WARNING|sun-appserver2.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=1e46e121-dc39-4df8-8717-f638ca99a1ff;|[C4003]: Error occurred on connection creation [localhost:37676]. - cause: java.net.SocketException: Connection reset|#]

[#|2010-11-15T10:07:11.597+0100|WARNING|sun-appserver2.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=1e46e121-dc39-4df8-8717-f638ca99a1ff;|[C4003]: Error occurred on connection creation [localhost:37676]. - cause: java.net.ConnectException: Connection refused|#]

[#|2010-11-15T10:07:12.601+0100|WARNING|sun-appserver2.1|javax.jms|_ThreadID=10;_ThreadName=main;_RequestID=1e46e121-dc39-4df8-8717-f638ca99a1ff;|[C4003]: Error occurred on connection creation [localhost:37676]. - cause: java.net.ConnectException: Connection refused|#]

After some research i found the setting which causes this weird behavior. This behavior is reproducible in Glassfish 2.1 and 2.2.
It was found in the host file on the server node in question. Here i found the servers hostname to be written as a 127.0.0.1 address which makes the Glassfish server go wild.

After removing this entry , the JMS MQ port was made available and a connection could be build by the instance starting up.

Before :

127.0.0.1 YSGF02.hosting.yenlo.nl YSGF02 localhost
xxx.xxx.xxx.xxx YSGF02.hosting.yenlo.nl YSGF02

After

127.0.0.1 localhost
xxx.xxx.xxx.xxx YSGF02.hosting.yenlo.nl YSGF02