【Java】SpringCloud使用RabbitMQ报错ACCESS_REFUSED

配置文件

【Java】SpringCloud使用RabbitMQ报错ACCESS_REFUSED

rabbitmq-web管理

【Java】SpringCloud使用RabbitMQ报错ACCESS_REFUSED

错误日志

java.net.SocketException: Socket Closed

at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_171]

at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_171]

at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_171]

at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_171]

at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_171]

at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_171]

at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_171]

at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.1.2.jar:5.1.2]

at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.1.2.jar:5.1.2]

at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:580) ~[amqp-client-5.1.2.jar:5.1.2]

at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]

2018-07-09 11:36:23.707 WARN 8824 --- [on(8)-127.0.0.1] o.s.b.a.amqp.RabbitHealthIndicator : Rabbit health check failed

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) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:476) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:614) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:240) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1797) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1771) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1752) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.getVersion(RabbitHealthIndicator.java:48) ~[spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.doHealthCheck(RabbitHealthIndicator.java:44) ~[spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:84) ~[spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:47) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]

at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]

at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223) [spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]

at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:104) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:93) [spring-boot-actuator-2.0.2.RELEASE.jar:2.0.2.RELEASE]

at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.8.0_171]

at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.8.0_171]

at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) [na:1.8.0_171]

at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) [na:1.8.0_171]

at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) [na:1.8.0_171]

at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) [na:1.8.0_171]

at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) [na:1.8.0_171]

at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]

at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) [na:1.8.0_171]

at sun.rmi.transport.Transport$1.run(Transport.java:200) [na:1.8.0_171]

at sun.rmi.transport.Transport$1.run(Transport.java:197) [na:1.8.0_171]

at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_171]

at sun.rmi.transport.Transport.serviceCall(Transport.java:196) [na:1.8.0_171]

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) [na:1.8.0_171]

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835) [na:1.8.0_171]

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) [na:1.8.0_171]

at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_171]

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) [na:1.8.0_171]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_171]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_171]

at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_171]

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:351) ~[amqp-client-5.1.2.jar:5.1.2]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:957) ~[amqp-client-5.1.2.jar:5.1.2]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:907) ~[amqp-client-5.1.2.jar:5.1.2]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:847) ~[amqp-client-5.1.2.jar:5.1.2]

at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:449) ~[spring-rabbit-2.0.3.RELEASE.jar:2.0.3.RELEASE]

... 42 common frames omitted

请问如何解决这个错误?

回答

首先能够确认的是你需要设定用户的Topic permissions权限,直接点击set Topic permissions就可以了,但是我的权限设定是没有问题的,还是会有这个问题。若您已解决,请麻烦提供解决方案。
已解决:解决方案题主自己的解决方案没有成功,但是我成功了。具体原因请看官方文档有详细说明。这次记住一件事,官方文档为第一参考。

以上是 【Java】SpringCloud使用RabbitMQ报错ACCESS_REFUSED 的全部内容, 来源链接: utcz.com/a/87372.html

回到顶部