RabbitMQ new connection refused due to SocketException

rasika vijay picture rasika vijay · Apr 3, 2014 · Viewed 34.4k times · Source

while trying to create a new connection to rabbitmq running on a different server, I got the following error:

java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:406)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:533)


Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.net.SocketException: Connection reset


at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)



Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.readUnsignedByte(Unknown Source)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:131)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:533)

Steps taken :

  • rabbitmq is running on the server.
  • server is specified
  • default port is specified

lsof -i tcp:5672

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

beam.smp 3084 rabbitmq 15u IPv6 18611 0t0 TCP *:amqp (LISTEN)

rabbitmqctl list_connections

Listing connections ... guest client_server 55765 running ...done.

netstat -tapnl | grep 5672

tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 3084/beam.smp

tcp 0 0 0.0.0.0:55672 0.0.0.0:* LISTEN 3084/beam.smp

tcp 0 0 :::5672 :::* LISTEN 3084/beam.smp

Answer

Denis Makarskiy picture Denis Makarskiy · Aug 12, 2014

One of the possible reasons is that user you are connecting with to RabbitMQ has no rights to access to virtual hosts.

You can check this using Management Plugin (Admin tab).