Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

Tags:

rabbitmq

I have installed "erlang" and "rabbitmq" in my windows 7 machine. But when I am trying to run this code I am getting One exception.

package com.rabbitmq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
public class SendMessage {
  private final static String QUEUE_NAME = "hello";
  public static void main(String[] argv) throws Exception { 
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.queueDeclare(QUEUE_NAME, false, false, false, null);
    String message = "Hello World!";
    channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
    System.out.println(" [x] Sent '" + message + "'");
    channel.close();
    connection.close();
  }
}

I am getting this Exception.

Exception in thread "main" com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

This is the log:

11-Apr-2016::12:45:06 === Adding vhost 'localhost'

=INFO REPORT==== 11-Apr-2016::14:08:52 === accepting AMQP connection <0.360.0> (127.0.0.1:55327 -> 127.0.0.1:5672)

=ERROR REPORT==== 11-Apr-2016::14:08:52 === Error on AMQP connection <0.360.0> (127.0.0.1:55327 -> 127.0.0.1:5672, state: starting):

=INFO REPORT==== 11-Apr-2016::14:08:52 === closing AMQP connection <0.360.0> (127.0.0.1:55327 -> 127.0.0.1:5672)

When I am trying to list the users I am not getting any existing user and add_user is also not working in cmd link

like image 874
Chiranjit.B Avatar asked Apr 11 '16 08:04

Chiranjit.B


1 Answers

In your ConnectionFactory you need to set your username and password, if your have created any or you can use the default user "guest" with password "guest", which can be accessible only from localhost.

like image 143
Manmay Avatar answered Oct 14 '22 16:10

Manmay