Spring Boot集成RabbitMQ
作者:陆金龙
发表时间:2022-04-14 15:13
关键词:
1.internalRabbitListenerEndpointRegistry
监听服务启动失败,报错如下:
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
用户名密码错误
2.AmqpAuthenticationException
发送者服务发送消息失败,报错如下:
.ExceptionHandlerExceptionResolver : Resolved [org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN.
可能的原因:账号密码错误
1.账号密码错误。
2.账号密码权限问题。
3.查看是否允许非localhost登陆
排查结果:账号不存在。
因为部署了5672和5673两套RabbitMQ,测试时用的是5673,而ams账号是5672的账号。
把端口改为5672之后解决。测试时尽量使用简单环境。
---
spring:
rabbitmq:
host: 172.x.x.x
port: 5673
username: ams
password: ams123
virtual-host: /