java - RabbitMQ : Cannot connect to distant machine (RPC) -


i want connect 2 machines using rabbitmq, using remote procedure call. have 2 machines, local machine (address : 10.3.9.73) , vm machine (address : 10.3.9.2) . these adresses pingable. run client app in vm machine using code :

connectionfactory factory = new connectionfactory(); factory.sethost("10.3.9.73"); factory.setport(5672); connection = factory.newconnection(); channel = connection.createchannel();  replyqueuename = channel.queuedeclare().getqueue(); consumer = new queueingconsumer(channel); channel.basicconsume(replyqueuename, true, consumer); 

and server app in local machine using code :

connectionfactory factory = new connectionfactory(); factory.sethost("localhost"); factory.setport(5672);      connection = factory.newconnection(); channel = connection.createchannel(); channel.queuedeclare(rpc_queue_name, false, false, false, null); channel.basicqos(1); queueingconsumer consumer = new queueingconsumer(channel); channel.basicconsume(rpc_queue_name, false, consumer); system.out.println(" [x] awaiting rpc requests"); 

the code of client app fails , shows error:

"com.rabbitmq.client.authenticationfailureexception: access_refused - login refused using authentication mechanism plain. details see broker logfile." 

how solve problem?

can please put logfile content.

i think should configure login , password :

sudo cp /usr/share/doc/rabbitmq-server-[rabbitmq version]/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config  

then search

%%{loopback_users, []} 

and remove ‘%%’, restart rabbitmq server.

then should add following lines in code:

factory.setusername("guest"); factory.setpassword("guest"); 

by default, can use guest login , password

if doesn't work, should test if client can connect server through port 5672

 telnet 10.3.9.73 5672 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -