I am trying to send messages between two local PC (Windows OS). I have connected to these PC using LAN connection. The RabbitMQ server is installed on 10.100.94.25 PC. I am trying to create a connection from 10.100.94.28 PC. I have ping to my rabbit MQ server PC (10.100.94.25) from Client PC (10.100.94.28) using windows command prompt. It was successful. But, when I try to create a connection from code, it is not working. Please check my code and error log bellow. the error is telling me that "timeout error". what should I do?
I have successfully sent and received a message from the same PC. That means, when I use localhost
as host, it works perfectly. Then what is the tiny touch I am missing here for remote access?
connectionFactory = new ConnectionFactory();
connectionFactory.setUsername("shoshi");
connectionFactory.setPassword("shoshi");
connectionFactory.setHost("10.100.94.25");
connectionFactory.setPort(5672);
connection = connectionFactory.newConnection(); // this is 451 number line
error:
May 01, 2016 6:00:35 PM com.chat.UI initRabbitMQ
SEVERE: null
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
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.PlainSocketImpl.connect(PlainSocketImpl.java:172)
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:714)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:760)
at com.chat.UI.initRabbitMQ(UI.java:451)
at com.chat.UI.<init>(UI.java:48)
at com.chat.UI$8.run(UI.java:405)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)