springcloud连接RabbitMQ报错 :An unexpected connection driver error occured

2020-04-18 12:20:49.489  INFO [zipkin-server,,,] 13584 --- [           main] o.s.c.stream.binder.BinderErrorChannel   : Channel 'zipkin-server:9411.sleuth.sleuth.errors' has 1 subscriber(s).
2020-04-18 12:20:49.490  INFO [zipkin-server,,,] 13584 --- [           main] o.s.c.stream.binder.BinderErrorChannel   : Channel 'zipkin-server:9411.sleuth.sleuth.errors' has 2 subscriber(s).
2020-04-18 12:20:49.507  INFO [zipkin-server,,,] 13584 --- [sleuth.sleuth-1] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [192.168.1.5:15672]
2020-04-18 12:20:54.510  INFO [zipkin-server,,,] 13584 --- [           main] o.s.i.a.i.AmqpInboundChannelAdapter      : started inbound.sleuth.sleuth
2020-04-18 12:20:54.510 ERROR [zipkin-server,,,] 13584 --- [2.168.1.5:15672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured

java.net.SocketException: Socket Closed
	at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_162]
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_162]
	at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_162]
	at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_162]
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_162]
	at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_162]
	at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_162]
	at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-4.0.3.jar:4.0.3]
	at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-4.0.3.jar:4.0.3]
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:571) ~[amqp-client-4.0.3.jar:4.0.3]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

 application.yml的配置文件是这样的:

spring:
  application:
    name: zipkin-server
  rabbitmq:
    host: 192.168.1.5
    port: 15672
    username: test
    password: test

网上很多都是说的没有权限,我这边权限是正常的:

用15672端口登录控制台也能登录:

springcloud连接RabbitMQ报错 :An unexpected connection driver error occured_第1张图片

用java写的连接程序直连也不行,后来才发现需要修改这个文件加上监听:

C:\Users\xxx\AppData\Roaming\RabbitMQ\advanced.config

没有加监听是这样的:

[].

修改为:

[{rabbit, [{tcp_listeners, [5673]}]} ].

将连接端口改为5673  成功连接!

总结一下:15672是RabbitMQ控制台的端口    真正的连接的端口不是这个控制台端口,需要在advanced.config配置文件中配置

你可能感兴趣的:(springcloud连接RabbitMQ报错 :An unexpected connection driver error occured)