Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RabbitMQ can't logged in #276

Closed
black-lotus opened this issue Aug 24, 2018 · 5 comments
Closed

RabbitMQ can't logged in #276

black-lotus opened this issue Aug 24, 2018 · 5 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@black-lotus
Copy link

I can't login with user rabbitmq and password rabbitmq
Both on my application (java app) and rabbitmq management

version: '3'

services:
rabbitmq:
    image: rabbitmq:3.7-management
    hostname: rabbitmq
    environment:
      RABBITMQ_ERLANG_COOKIE: SWQOKODSQALRPCLNMEQG
      RABBITMQ_DEFAULT_USER: rabbitmq
      RABBITMQ_DEFAULT_PASS: rabbitmq
      RABBITMQ_DEFAULT_VHOST: /
    volumes:
      - ./docker/rabbitmq:/var/lib/rabbitmq
    ports:
      - 5672:5672
      - 5671:5671
      - 15672:15672
      - 15671:15671

screen shot 2018-08-24 at 17 08 22

Failed login with rabbitmq management
screen shot 2018-08-24 at 17 09 10

Failed login with spring app

[ERROR] 2018-08-24 17:02:42 [main] o.s.b.SpringApplication Application startup failed
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
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348)
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151)
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.tiket.tix.flight.core.Main.main(Main.java:25)
Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:842)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:553)
	at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.startIfNecessary(RabbitListenerEndpointRegistry.java:272)
	at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.start(RabbitListenerEndpointRegistry.java:235)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175)
	... 14 common frames omitted
Caused by: org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
	at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:501)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1331)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
	at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65)
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:306)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:547)
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:90)
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:140)
	at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76)
	at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:496)
	... 2 common frames omitted
Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
	at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:338)
	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:824)
	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:778)
	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:898)
	at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:297)
	... 7 common frames omitted

Any help would be very appreciated

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Aug 24, 2018
@wglambert
Copy link

Works fine, I can also connect through the webui

$ docker run --rm -dP -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=pass --name rabbitmq rabbitmq:management
$ docker exec -it rabbitmq bash
root@e46daef7596f:/# rabbitmqadmin --username=user --password=pass list exchanges
rabbitmqadmin --username=user --password=pass list exchanges
+--------------------+---------+
|        name        |  type   |
+--------------------+---------+
|                    | direct  |
| amq.direct         | direct  |
| amq.fanout         | fanout  |
| amq.headers        | headers |
| amq.match          | headers |
| amq.rabbitmq.trace | topic   |
| amq.topic          | topic   |
+--------------------+---------+

Don't know what caused Fatal exception on listener startup without the entire context, you should try asking the Docker Community Forums, the Docker Community Slack, or Stack Overflow. As these repositories are for issues with the image and not necessarily for questions of usability

@black-lotus
Copy link
Author

helo @wglambert have yo tried my docker-compose script ?
for last update i can logged in to rabbitmq management when i logged in using
username : "rabbitmq"
password : "rabbitmq"
i'm not sure why i have to wrap rabbitmq with double quotes (")

@ckatzer4
Copy link

ckatzer4 commented Aug 27, 2018

Seeing something similar, using the rabbitmq:3.7.7-management image.

I have the RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS variables defined in the environment section of a docker-compose.yml, and I can't log into the management web page with those defined credentials.

Interestingly, guest/guest still works.

@wglambert
Copy link

Using your docker-compose.yml

version: '3'

services:
 rabbitmq:
    image: rabbitmq:3.7-management
    hostname: rabbitmq
    environment:
      RABBITMQ_ERLANG_COOKIE: SWQOKODSQALRPCLNMEQG
      RABBITMQ_DEFAULT_USER: rabbitmq
      RABBITMQ_DEFAULT_PASS: rabbitmq
      RABBITMQ_DEFAULT_VHOST: /
    volumes:
      - ./docker/rabbitmq:/var/lib/rabbitmq
    ports:
      - 5672:5672
      - 5671:5671
      - 15672:15672
      - 15671:15671
$ docker-compose up -d
Creating network "rabbitmq-276_default" with the default driver
Creating rabbitmq-276_rabbitmq_1 ... done
$ docker exec -it rabbitmq-276_rabbitmq_1 bash
root@rabbitmq:/# rabbitmqadmin --username=rabbitmq --password=rabbitmq list exchanges
+--------------------+---------+
|        name        |  type   |
+--------------------+---------+
|                    | direct  |
| amq.direct         | direct  |
| amq.fanout         | fanout  |
| amq.headers        | headers |
| amq.match          | headers |
| amq.rabbitmq.trace | topic   |
| amq.topic          | topic   |
+--------------------+---------+

@tianon
Copy link
Member

tianon commented Aug 27, 2018

i'm not sure why i have to wrap rabbitmq with double quotes (")

So, this is probably because when you first did it, your syntax probably included quotes something like this:

    environment:
      - RABBITMQ_DEFAULT_USER="rabbitmq"
      - RABBITMQ_DEFAULT_PASS="rabbitmq"

This sets the environment variables with literal quotes, which would explain why the quotes were required when logging in. With this syntax, you either want quotes around the entire string, or not at all (ala, - "RABBITMQ_DEFAULT_USER=rabbitmq"), since this is YAML syntax.

Interestingly, guest/guest still works.

I believe this (and the crux of this issue) boil down to docker-library/postgres#203 (comment). When you set these variables, their values get embedded in the database itself as defaults and changing them in the environment/configuration will not change the data unless you also reset your database contents.

See also #150 (comment).

@tianon tianon closed this as completed Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

4 participants