Access refused - Login was refused using authentication mechanism PLAIN RabbitMQ Queue

10,141

The guest user can only connect to localhost by default: see the documentation.

"guest" user can only connect via localhost

By default, the guest user is prohibited from connecting to the broker remotely; it can only connect over a loopback interface (i.e. localhost). This applies both to AMQP 0-9-1 and to any other protocols enabled via plugins. Any other users you create will not (by default) be restricted in this way.

This is configured via the loopback_users item in the configuration file.

If you wish to allow the guest user to connect from a remote host, you should set the loopback_users configuration to none.

...

Share:
10,141

Related videos on Youtube

Sanjay Kumar
Author by

Sanjay Kumar

Updated on June 04, 2022

Comments

  • Sanjay Kumar
    Sanjay Kumar almost 2 years

    I am trying to use RabbitMQ for posting messages from one application and receiving them in another. I am able to post messages using localhost.

    ex:  amqp://guest:guest@localhost:5672
    

    when i trying to post messages using different Ip getting below mention exception.

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

    sample code:

    private  Connection getConnection(){
        Connection connection = null;
        try {
            ConnectionFactory factory = new ConnectionFactory();
            final URI uri = URI.create(PropertyReader.read("rabbit.mq.uri").trim());
            factory.setConnectionTimeout(30000);
            factory.setAutomaticRecoveryEnabled(true);
            factory.setTopologyRecoveryEnabled(true);
            factory.setNetworkRecoveryInterval(10000);
            factory.setExceptionHandler(new DefaultExceptionHandler());
            factory.setRequestedHeartbeat(360); 
            factory.setUri(uri);
    
            connection = factory.newConnection();
            LOGGER.info("Rabbit MQ Connection established successfully");
        } catch (Exception e) {
            LOGGER.error("Error { }"+e);
        } 
        return connection;
    }
    

    I need help for this.

    using telnet i checked provided Ip.

    • Sanjay Kumar
      Sanjay Kumar over 6 years
      using telnet i check the server ip, its connected
  • Sanjay Kumar
    Sanjay Kumar over 6 years
    Hi Gary, Thanks for reply. I changed the username and password, Still am getting same exception. amqp://****:*****@**.**.**.**.**:5672
  • Gary Russell
    Gary Russell over 6 years
    You must still have something mis-configured.