reply-code=530, reply-text=NOT_ALLOWED - vhost / not found, class-id=10, method-id=40

springboot 项目在启动项目时,报链接rabbitmq报错

Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - vhost / not found, class-id=10, method-id=40)
 at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[amqp-client-5.4.3.jar:5.4.3]
 at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-5.4.3.jar:5.4.3]
 at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494) ~[amqp-client-5.4.3.jar:5.4.3]
 at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:288) ~[amqp-client-5.4.3.jar:5.4.3]
 at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:138) ~[amqp-client-5.4.3.jar:5.4.3]
 ... 15 common frames omitted

通过 Caused by 可以定位 vhost 名称没找到

  1. 处理方式一(推荐)
    在 application.properties 文件中添加 spring.rabbitmq.virtual-host=my_vhost
  2. 处理方式二(推荐)
    在 rabbitmq 管理后天中添加 my_vhost 目录
  3. 处理方式三
    在启动docker时指定vhost : RABBITMQ_DEFAULT_VHOST=my_vhost
docker run -d --name rabbitmq3.8.2-management-alpine -p 5672:5672 -p 15672:15672 --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost  -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=123456 27676558455e

你可能感兴趣的:(rabbitmq,rabbitmq)