It could also indicate that you have the port wrong (which doesn't seem
likely since you say that this is after a broker restart) or that the
broker isn't currently listening on that port for some reason (though
that isn't expected and would likely be a bug if that's what's happening).
I think it's also the exception you'd get if a firewall was preventing a
connection from being established, though that also doesn't seem likely.

Your first step should be to confirm that the broker is actually listening
on your TCP port (61616) at the time you're getting these exceptions, using
a tool such as netstat or lsof.  If the port is indeed up and you're
getting this exception, try using Telnet from that same host to open a
connection to that port; if it succeeds, then the problem is in the client,
and if it fails then your problem is in the network (e.g. a firewall).  If
the problem's in the client, attach a debugger and set a breakpoint
(FailoverTransport.java:148 would be a good starting point) and step
through to figure out what's going on.  Also, Wireshark could be useful to
help figure out what's going on by inspecting your TCP traffic.

On Mon, Dec 22, 2014 at 9:14 AM, Timothy Bish <tabish...@gmail.com> wrote:

> On 12/22/2014 10:55 AM, khandelwalanuj wrote:
>
>> Hi,
>>
>> We have seen this warning lot of time in client side logs.
>> "java.net.ConnectException: Connection refused"
>>
>> As we can see in stacktrace that this is not generated from ActiveMQ code
>> or
>> any JMSException. This is coming from lower layer.
>>
>> Can someone help me to understand this exception? When can cause this?
>>
>>
>> [20141222 09:53:34.308 EST (ActiveMQ Task-3)
>> org.apache.activemq.ActiveMQConnection#onAsyncException 2010 DEBUG] -
>> Async
>> exception with no exception listener: java.net.ConnectException:
>> Connection
>> refused
>> *java.net.ConnectException: Connection refused*
>>          at java.net.PlainSocketImpl.socketConnect(Native Method)
>>          at
>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:
>> 345)
>>          at
>> java.net.AbstractPlainSocketImpl.connectToAddress(
>> AbstractPlainSocketImpl.java:206)
>>          at
>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
>> 188)
>>          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>>          at java.net.Socket.connect(Socket.java:589)
>>          at
>> org.apache.activemq.transport.tcp.TcpTransport.connect(
>> TcpTransport.java:501)
>>          at
>> org.apache.activemq.transport.tcp.TcpTransport.doStart(
>> TcpTransport.java:464)
>>          at
>> org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
>>          at
>> org.apache.activemq.transport.AbstractInactivityMonitor.start(
>> AbstractInactivityMonitor.java:138)
>>          at
>> org.apache.activemq.transport.TransportFilter.start(
>> TransportFilter.java:58)
>>          at
>> org.apache.activemq.transport.WireFormatNegotiator.start(
>> WireFormatNegotiator.java:72)
>>          at
>> org.apache.activemq.transport.failover.FailoverTransport.
>> doReconnect(FailoverTransport.java:1017)
>>          at
>> org.apache.activemq.transport.failover.FailoverTransport$2.
>> iterate(FailoverTransport.java:148)
>>          at
>> org.apache.activemq.thread.PooledTaskRunner.runTask(
>> PooledTaskRunner.java:133)
>>          at
>> org.apache.activemq.thread.PooledTaskRunner$1.run(
>> PooledTaskRunner.java:48)
>>          at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(
>> ThreadPoolExecutor.java:1142)
>>          at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(
>> ThreadPoolExecutor.java:617)
>>          at java.lang.Thread.run(Thread.java:745)
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://activemq.2283324.n4.
>> nabble.com/java-net-ConnectException-Connection-refused-in-client-logs-
>> tp4689178.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>  Connection refused indicates that there is not broker or no route to
> that host so the client can't connect.  Ensure that you have a valid URI
> and that the host name maps to correct IP
>
> --
> Tim Bish
> Sr Software Engineer | RedHat Inc.
> tim.b...@redhat.com | www.redhat.com
> skype: tabish121 | twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>

Reply via email to