RabbitMq ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

10,611 views
Skip to first unread message

Sercan Noyan Germiyanoglu

unread,
Aug 10, 2022, 5:33:26 PM8/10/22
to rabbitmq-users
Hi,

I tried to implement an example of spring cloud example.

I run rabbitmq in docker through docker-compose.

rabbitmq:
   image: "rabbitmq:3-management"
   container_name: "rmq3"
   environment:
      RABBITMQ_DEFAULT_USER: "rabbitmq"
      RABBITMQ_DEFAULT_PASS: "123456"
   ports:
      - "5672:5672"
      - "15672:15672"

When I run report service, I got all these issues shown below.
org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

How can I fix it?


Luke Bakken

unread,
Aug 16, 2022, 6:17:19 PM8/16/22
to rabbitmq-users
Hello,

Thanks for providing a very complete set of code and configuration to see this issue.

I forked the repository and simplified the docker compose file to only start RabbitMQ, so that I can confirm that the user and password are set correctly:


I then started it up, and exec'd into the running container to verify:

root@fdaeccf96a12:/# rabbitmqctl eval 'os:getenv("RABBITMQ_DEFAULT_USER").'
"rabbitmq"
root@fdaeccf96a12:/# rabbitmqctl eval 'os:getenv("RABBITMQ_DEFAULT_PASS").'
"123456"
root@fdaeccf96a12:/# rabbitmqctl authenticate_user rabbitmq 123456
Authenticating user "rabbitmq" ...
Success


So, it seems that your user and password are indeed created correctly. My guess now is that your Spring application is not being configured correctly.

I tried running docker compose up on the entire original project but ran into errors. Not sure why.

Thanks,
Luke

Gary Russell

unread,
Aug 17, 2022, 10:57:27 AM8/17/22
to rabbitm...@googlegroups.com
I see you are using config server; from my limited knowledge of that project, you appear to be setting things up correctly [1] [2].

I suggest you add some diagnostics to the report-service; something like

@Bean
ApplicationRunner runner(CachingConnectionFactory ccf) {
    return args -> {
        log.info(ccf.getRabbitConnectionFactory().getUsername());
        log.info(ccf.getRabbitConnectionFactory().getPassword());
     };
}

to make sure the config is being applied correctly; if it is not, I suggest you reach out the config server project.




From: rabbitm...@googlegroups.com <rabbitm...@googlegroups.com> on behalf of Luke Bakken <luker...@gmail.com>
Sent: Tuesday, August 16, 2022 6:17 PM
To: rabbitmq-users <rabbitm...@googlegroups.com>
Subject: [rabbitmq-users] Re: RabbitMq ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
 

⚠ External Email

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/e0511c64-0e33-4bc8-b8d8-d0e7b4516e40n%40googlegroups.com.


⚠ External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender.

Reply all
Reply to author
Forward
0 new messages