python - rabbitmq not working with java -


I have a rabbit setup on my machine and it has 3 different queues. A Java code is listening to a queue and other queues Sending messages to Python code. Now the Python code is working fine but Java code has problems with AMQ. The following error is coming:

  exception in thread "main" com.rabbitmq.client.PossibleAuthenticationFailureException: probably: com.rabbitmq.client.impl.AMQConnection.start authentication failure due to ( AMQConnection.java: 341) on com.rabbitmq.client.ConnectionFactory.newConnection (ConnectionFactory.javaitter90) on com.rabbitmq.client.ConnectionFactory.newConnection (ConnectionFactory.java:612) on com.elki.test.Worker.main (worker Java: 73) Reason: Connection error at com.rabbitmq.client.ShutdownSignalException: com.rabbitmq.utility.ValueOrException.getValue (ValueOrException.java:67) Com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue (BlockingValueOrException.java:33) $ blockingRpcContinuation.getReply at Com.rabbitmq.client.impl.AMQChannel (AMQChannel.java:343) at com.rabbitmq.client.impl.AMQChannel.privateRpc ( AMQChannel.javamore16) at com.rabbitmq.client.impl. AMQChannel.rpc (AMQChannel.java202) T.impl.AMQConnection.start (AMQConnection.java:326) on com.rabbitmq.clien ... 3 caused by: java.io.EOFException on java.io.DataInputStream.readUnsignedByte ( DataInputStream.javathing90) Fremkredfrm (frame com.rabbitmq.client.impl.SocketFrameHandler.readFrame (SocketFrameHandler.java:139) on Com.rabbitmq.client.impl.AMQConnection $ MainLoop.run on com.rabbitmq.client.impl How do I get an  AuthenticationFailure  at  

Can not be with Java but with Python. Any help appreciated

Code :.

public static void I (String [] argv) throws java.io.IOException, java.lang.InterruptedException {ConnectionFactory factory = New ConnectionFactory (); Factory.setHost ("127.0.0.1"); Factory.setport (5672); Com.rabbitmq.client.Connection connection = factory.newConnection (); Channel channel = connection.createChannel (); Channel.queueDeclare (TASK_QUEUE_NAME, true, wrong, false, zero); System.out.println ("Waiting for messages, CTRL + C to exit"); Channel.basicQos (1); Quewing Consumer Consumer = New Quaking Consumer (Channel); Channel.basicConsume (TASK_QUEUE_NAME, Incorrect, Consumer); While (true) {QueueingConsumer.Delivery Delivery = Consumer. NxtDelivery (); String message = new string (delivery.getBody ()); System.out.println ("[x] received '" + Message + "' ');" Do some work "System.out.println (" [x] done "); Int prefetch count = 1; channel.basicQos ( PrefetchCount); Channel.basicAck (distribution .getEnvelope (). GetDeliveryTag (), false);}}

I think this is because you do not set the password and the username on the ConnectionFactory object, and so it RabbitMQ (Maybe your dragon code is passing through them, and so is it A).

Before calling, factory.newConnection try adding this code:

factory.setUsername ( UserName); factory.setPassword (password);

instead of userName and password as required by your code. / P>


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -