How to resolve RabbitMQ Server connection error in Spring-cloud-sleuth-zipkin (Edgware.SR5)

不想你离开。 提交于 2021-02-10 13:51:22

问题


I need to send spans through RabbitMQ to Zipkin. I'm Using Spring-Cloud-Sleuth Edgware-SR5 version and SpringBoot 1.5.3.RELEASE versions. With older Spring-cloud sleuth version (spring-cloud-stream-binder-rabbit - v1.1.4.RELEASE) it was working fine.

When I try to start the service, I'm getting " "AsyncReporter{RabbitMQSender{addresses=[localhost:5672], queue=zipkin}}. Unable to establish connection to RabbitMQ server" error. I have gone through the documentations, but I could't able to resolve this issue.

Gradle Configuration:

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Edgware.SR5"
    }
}

compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
compile 'org.springframework.cloud:spring-cloud-starter-zipkin'
compile 'org.springframework.boot:spring-boot-starter-amqp'
compile 'org.springframework.amqp:spring-rabbit'

Application.yml:

spring:
  sleuth:
    enabled: true
    async:
      enabled: true
  sampler:
    percentage: 1.0 
  zipkin:
    baseUrl: 
    sender:
      type: rabbit

Exception StackTrace:

Exception in thread "AsyncReporter{RabbitMQSender{addresses=[localhost:5672], queue=zipkin}}" java.lang.IllegalStateException: Unable to establish connection to RabbitMQ server
    at zipkin2.reporter.amqp.RabbitMQSender.get(RabbitMQSender.java:190)
    at zipkin2.reporter.amqp.AutoValue_RabbitMQSender.get(AutoValue_RabbitMQSender.java:27)
    at zipkin2.reporter.amqp.RabbitMQSender$1.initialValue(RabbitMQSender.java:211)
    at zipkin2.reporter.amqp.RabbitMQSender$1.initialValue(RabbitMQSender.java:208)
    at java.lang.ThreadLocal.setInitialValue(Unknown Source)
    at java.lang.ThreadLocal.get(Unknown Source)
    at zipkin2.reporter.amqp.RabbitMQSender$RabbitMQCall.publish(RabbitMQSender.java:231)
    at zipkin2.reporter.amqp.RabbitMQSender$RabbitMQCall.doExecute(RabbitMQSender.java:226)
    at zipkin2.reporter.amqp.RabbitMQSender$RabbitMQCall.doExecute(RabbitMQSender.java:218)
    at zipkin2.Call$Base.execute(Call.java:379)
    at zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:272)
    at zipkin2.reporter.AsyncReporter$Builder$1.run(AsyncReporter.java:179)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:50)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:907)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:859)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:736)
    at zipkin2.reporter.amqp.RabbitMQSender.get(RabbitMQSender.java:188)

Thanks and Regards Suresh


回答1:


Connection refused: connect

Simply means that RabbitMQ is not running on localhost:5672 (which is the default if you don't provide a host/port, or addresses, for it in your application.yml).



来源:https://stackoverflow.com/questions/53208598/how-to-resolve-rabbitmq-server-connection-error-in-spring-cloud-sleuth-zipkin-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!