RabbitMQ "Hello World" example gives "Connection Refused"

To deal with it I installed RabbitMQ server. If rabbitmq-server is not installed this error will be thrown. Make sure you have installed RabbitMQ server and it's up and running by hitting http://localhost:15672/


I got this "Connection Refused" error as well:

Exception in thread "main" java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at ReceiveLogs.main(ReceiveLogs.java:14)

I had made a mistake by setting the IP address from inside /etc/rabbitmq/rabbitmq-env.conf to the wrong ip address:

NODE_IP_ADDRESS=10.0.1.45

I removed this configuration parameter and the error goes away.