当前位置:   article > 正文

spring 远程连接 rabbitMQ 报错_org.springframework.amqp.amqpauthenticationexcepti

org.springframework.amqp.amqpauthenticationexception: com.rabbitmq.client.au

 1、springboot配置文件 application.peroproperties

  1. spring.rabbitmq.username=guest
  2. spring.rabbitmq.password=guest
  3. spring.rabbitmq.host=192.168.0.125
  4. #spring.rabbitmq.host=localhost
  5. spring.rabbitmq.port=5672
  6. spring.rabbitmq.virtual-host=/
  7. spring.rabbitmq.listener.simple.acknowledge-mode=manual

2、错误栈

  1. "C:\Program Files\Java\jdk1.8.0_211\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\work\IntelliJ IDEA 2019.1\lib\idea_rt.jar=54709:D:\work\IntelliJ IDEA 2019.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_211\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_211\jre\lib\rt.jar;D:\work\workspace\sp2\target\classes;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter-amqp\2.1.4.RELEASE\spring-boot-starter-amqp-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter\2.1.4.RELEASE\spring-boot-starter-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot\2.1.4.RELEASE\spring-boot-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.4.RELEASE\spring-boot-autoconfigure-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter-logging\2.1.4.RELEASE\spring-boot-starter-logging-2.1.4.RELEASE.jar;D:\work\maven2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\work\maven2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\work\maven2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;D:\work\maven2\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;D:\work\maven2\repository\org\slf4j\jul-to-slf4j\1.7.26\jul-to-slf4j-1.7.26.jar;D:\work\maven2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\work\maven2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;D:\work\maven2\repository\org\springframework\spring-messaging\5.1.6.RELEASE\spring-messaging-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-beans\5.1.6.RELEASE\spring-beans-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\amqp\spring-rabbit\2.1.5.RELEASE\spring-rabbit-2.1.5.RELEASE.jar;D:\work\maven2\repository\org\springframework\amqp\spring-amqp\2.1.5.RELEASE\spring-amqp-2.1.5.RELEASE.jar;D:\work\maven2\repository\org\springframework\retry\spring-retry\1.2.4.RELEASE\spring-retry-1.2.4.RELEASE.jar;D:\work\maven2\repository\com\rabbitmq\amqp-client\5.4.3\amqp-client-5.4.3.jar;D:\work\maven2\repository\org\springframework\spring-context\5.1.6.RELEASE\spring-context-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-tx\5.1.6.RELEASE\spring-tx-5.1.6.RELEASE.jar;D:\work\maven2\repository\com\alibaba\fastjson\1.2.46\fastjson-1.2.46.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter-web\2.1.4.RELEASE\spring-boot-starter-web-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter-json\2.1.4.RELEASE\spring-boot-starter-json-2.1.4.RELEASE.jar;D:\work\maven2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;D:\work\maven2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\work\maven2\repository\com\fasterxml\jackson\core\jackson-core\2.9.8\jackson-core-2.9.8.jar;D:\work\maven2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar;D:\work\maven2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar;D:\work\maven2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.8\jackson-module-parameter-names-2.9.8.jar;D:\work\maven2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.4.RELEASE\spring-boot-starter-tomcat-2.1.4.RELEASE.jar;D:\work\maven2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.17\tomcat-embed-core-9.0.17.jar;D:\work\maven2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.17\tomcat-embed-el-9.0.17.jar;D:\work\maven2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.17\tomcat-embed-websocket-9.0.17.jar;D:\work\maven2\repository\org\hibernate\validator\hibernate-validator\6.0.16.Final\hibernate-validator-6.0.16.Final.jar;D:\work\maven2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\work\maven2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\work\maven2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\work\maven2\repository\org\springframework\spring-web\5.1.6.RELEASE\spring-web-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-webmvc\5.1.6.RELEASE\spring-webmvc-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-aop\5.1.6.RELEASE\spring-aop-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-expression\5.1.6.RELEASE\spring-expression-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;D:\work\maven2\repository\org\springframework\spring-core\5.1.6.RELEASE\spring-core-5.1.6.RELEASE.jar;D:\work\maven2\repository\org\springframework\spring-jcl\5.1.6.RELEASE\spring-jcl-5.1.6.RELEASE.jar" me.zhao.Sp2Application
  2. . ____ _ __ _ _
  3. /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
  4. ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  5. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  6. ' |____| .__|_| |_|_| |_\__, | / / / /
  7. =========|_|==============|___/=/_/_/_/
  8. :: Spring Boot :: (v2.1.4.RELEASE)
  9. 2019-04-28 19:24:39.155 INFO 12676 --- [ main] me.zhao.Sp2Application : Starting Sp2Application on DESKTOP-R8ILOJH with PID 12676 (D:\work\workspace\sp2\target\classes started by zhaobs in D:\work\workspace\sp2)
  10. 2019-04-28 19:24:39.178 INFO 12676 --- [ main] me.zhao.Sp2Application : No active profile set, falling back to default profiles: default
  11. 2019-04-28 19:24:41.684 INFO 12676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
  12. 2019-04-28 19:24:41.718 INFO 12676 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
  13. 2019-04-28 19:24:41.718 INFO 12676 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17]
  14. 2019-04-28 19:24:41.919 INFO 12676 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
  15. 2019-04-28 19:24:41.919 INFO 12676 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2575 ms
  16. 2019-04-28 19:24:42.401 INFO 12676 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
  17. 2019-04-28 19:24:42.933 INFO 12676 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [192.168.0.125:5672]
  18. 2019-04-28 19:24:42.980 WARN 12676 --- [.168.0.125:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured (Exception message: Connection reset)
  19. 2019-04-28 19:24:42.982 INFO 12676 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Broker not available; cannot force queue declarations during start: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
  20. 2019-04-28 19:24:42.991 INFO 12676 --- [ntContainer#0-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [192.168.0.125:5672]
  21. 2019-04-28 19:24:43.004 ERROR 12676 --- [.168.0.125:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
  22. java.net.SocketException: socket closed
  23. at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_211]
  24. at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_211]
  25. at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_211]
  26. at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_211]
  27. at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_211]
  28. at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_211]
  29. at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_211]
  30. at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.4.3.jar:5.4.3]
  31. at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.4.3.jar:5.4.3]
  32. at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:596) ~[amqp-client-5.4.3.jar:5.4.3]
  33. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
  34. 2019-04-28 19:24:43.005 ERROR 12676 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
  35. org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
  36. at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  37. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  38. at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:682) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  39. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  40. at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:2073) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  41. at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2047) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  42. at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2027) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  43. at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:403) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  44. at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.attemptDeclarations(AbstractMessageListenerContainer.java:1787) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  45. at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1768) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  46. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1195) [spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  47. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1041) [spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  48. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
  49. Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
  50. at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362) ~[amqp-client-5.4.3.jar:5.4.3]
  51. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104) ~[amqp-client-5.4.3.jar:5.4.3]
  52. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
  53. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
  54. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  55. ... 11 common frames omitted
  56. 2019-04-28 19:24:43.009 INFO 12676 --- [ntContainer#0-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [192.168.0.125:5672]
  57. 2019-04-28 19:24:43.018 ERROR 12676 --- [.168.0.125:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
  58. java.net.SocketException: socket closed
  59. at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_211]
  60. at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_211]
  61. at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_211]
  62. at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_211]
  63. at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_211]
  64. at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_211]
  65. at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_211]
  66. at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.4.3.jar:5.4.3]
  67. at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.4.3.jar:5.4.3]
  68. at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:596) ~[amqp-client-5.4.3.jar:5.4.3]
  69. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
  70. 2019-04-28 19:24:43.020 ERROR 12676 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer received fatal exception on startup
  71. org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
  72. at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:576) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  73. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1196) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  74. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1041) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  75. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
  76. 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.
  77. at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  78. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  79. at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:682) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  80. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  81. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$RabbitResourceFactory.createConnection(ConnectionFactoryUtils.java:293) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  82. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:131) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  83. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:93) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  84. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  85. at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:570) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  86. ... 3 common frames omitted
  87. Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
  88. at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362) ~[amqp-client-5.4.3.jar:5.4.3]
  89. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104) ~[amqp-client-5.4.3.jar:5.4.3]
  90. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
  91. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
  92. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  93. ... 10 common frames omitted
  94. 2019-04-28 19:24:43.023 WARN 12676 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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
  95. 2019-04-28 19:24:43.026 INFO 12676 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Waiting for workers to finish.
  96. 2019-04-28 19:24:43.026 ERROR 12676 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Stopping container from aborted consumer
  97. 2019-04-28 19:24:43.026 INFO 12676 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Successfully waited for workers to finish.
  98. 2019-04-28 19:24:43.026 INFO 12676 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Shutdown ignored - container is not active already
  99. 2019-04-28 19:24:43.027 INFO 12676 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Shutdown ignored - container is not active already
  100. 2019-04-28 19:24:43.028 INFO 12676 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
  101. 2019-04-28 19:24:43.034 INFO 12676 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
  102. 2019-04-28 19:24:43.053 INFO 12676 --- [ main] ConditionEvaluationReportLoggingListener :
  103. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  104. 2019-04-28 19:24:43.064 ERROR 12676 --- [ main] o.s.boot.SpringApplication : Application run failed
  105. 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
  106. at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  107. at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  108. at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  109. at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  110. at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  111. at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  112. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  113. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  114. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  115. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  116. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  117. at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  118. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  119. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  120. at me.zhao.Sp2Application.main(Sp2Application.java:9) [classes/:na]
  121. Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
  122. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.waitForConsumersToStart(SimpleMessageListenerContainer.java:553) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  123. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:511) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  124. at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:1296) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  125. at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.startIfNecessary(RabbitListenerEndpointRegistry.java:294) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  126. at org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry.start(RabbitListenerEndpointRegistry.java:249) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  127. at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
  128. ... 14 common frames omitted
  129. Caused by: org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException: Authentication failure
  130. at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:576) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  131. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1196) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  132. at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1041) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  133. at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_211]
  134. 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.
  135. at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:65) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  136. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  137. at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:682) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  138. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  139. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$RabbitResourceFactory.createConnection(ConnectionFactoryUtils.java:293) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  140. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:131) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  141. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:93) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  142. at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  143. at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:570) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  144. ... 3 common frames omitted
  145. Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
  146. at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362) ~[amqp-client-5.4.3.jar:5.4.3]
  147. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104) ~[amqp-client-5.4.3.jar:5.4.3]
  148. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
  149. at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
  150. at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.5.RELEASE.jar:2.1.5.RELEASE]
  151. ... 10 common frames omitted
  152. Process finished with exit code -1

3、解决办法

我这里犯了一个错误是使用 guest 进行远程连接,guest用户是rabbitMQ的默认用户,拥有很大的权限,并且被限制为只能进行本地登录即(localhost),应新建用户配置权限进行远程访问,这里用的是windows环境。

  1. rabbitmqctl.bat add_user zhao root
  2. rabbitmqctl.bat set_user_tags zhao administrator
  3. rabbitmqctl.bat set_permissions -p / zhao ".*" ".*" ".*"

 完成上述操作后,修改application.properties文件的用户名、密码即可成功连接。

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/1018425
推荐阅读
相关标签
  

闽ICP备14008679号