Recently engaged in the interface, need to use the RABBITMQ, the company engaged in an afternoon or not connected, and then a closer look at the English explanation, test connection success, the following error points.
I used the installation package: Otp_win64_17.0.exe (Erlang vm) and Rabbitmq-server-3.3.1.exe last tested successfully.
The code snippet for the connection is as follows
Com.rabbitmq.client.ConnectionFactory factory = new Com.rabbitmq.client.ConnectionFactory ();
Factory.sethost ("localhost");
Factory.setport (5672);
Factory.setusername ("Guest");
Factory.setpassword ("Guest");
The default installation is RABBITMQ service (Windows service), but no web monitoring (localhost:15672);
The default port is 5672, the user guest password guest, but this user name only in the local access, if you want to network access, need to do user management;
1, if write the wrong host (such as: Factory.sethost ("Locathost"); Error
Exception in thread "main" java.net.UnknownHostException:locathost
At Java.net.PlainSocketImpl.connect (plainsocketimpl.java:195)
At Java.net.SocksSocketImpl.connect (sockssocketimpl.java:366)
At Java.net.Socket.connect (socket.java:529)
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 Com.aaa.test.Send.main (send.java:19)
2, if the wrong host IP (such as: Factory.sethost ("192.168.1.10"); ) Without this address, error:
Exception in thread "main" Java.net.ConnectException:Connection timed Out:connect
At Java.net.PlainSocketImpl.socketConnect (Native Method)
At Java.net.PlainSocketImpl.doConnect (plainsocketimpl.java:351)
At Java.net.PlainSocketImpl.connectToAddress (plainsocketimpl.java:213)
At Java.net.PlainSocketImpl.connect (plainsocketimpl.java:200)
At Java.net.SocksSocketImpl.connect (sockssocketimpl.java:366)
At Java.net.Socket.connect (socket.java:529)
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 Com.aaatest.Send.main (send.java:19)
3, if the wrong port (such as: Factory.setport (5678);) Error:
Exception in thread "main" Java.net.ConnectException:Connection Refused:connect
At Java.net.PlainSocketImpl.socketConnect (Native Method)
At Java.net.PlainSocketImpl.doConnect (plainsocketimpl.java:351)
At Java.net.PlainSocketImpl.connectToAddress (plainsocketimpl.java:213)
At Java.net.PlainSocketImpl.connect (plainsocketimpl.java:200)
At Java.net.SocksSocketImpl.connect (sockssocketimpl.java:366)
At Java.net.Socket.connect (socket.java:529)
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 Com.aaa.test.Send.main (send.java:19)
4, if the wrong user name or password, error:
Exception in thread "main" Com.rabbitmq.client.authenticationfailureexception:access_refused-login is refused using a Uthentication mechanism PLAIN. For details see the broker logfile.
At Com.rabbitmq.client.impl.AMQConnection.start (amqconnection.java:338)
At Com.rabbitmq.client.ConnectionFactory.newConnection (connectionfactory.java:590)
At Com.rabbitmq.client.ConnectionFactory.newConnection (connectionfactory.java:612)
At Com.aaa.test.Send.main (send.java:19)
May be a master to see will laugh, so simple things to engage in half a day, but I am not a master, write to their own record.