RabbitMQ Java 客户端:不支持或无法识别的 SSL 消息

问题描述 投票:0回答:0

我有一个 Kotlin 应用程序在成功打开连接、声明交换和队列等后尝试在已建立的通道上执行

SSLException
时获得
basicGet
...

我不明白为什么它首先尝试发送 SSL 消息,因为连接工厂没有启用 SSL,我希望这个错误发生在声明交换、队列或绑定时,而不是下游时试图从队列中获取消息。

异常本身是:

javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
   at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:456) ~[?:?]
   at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:175) ~[?:?]
   at sun.security.ssl.SSLTransport.decode(SSLTransport.java:111) ~[?:?]
   at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510) ~[?:?]
   at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425) ~[?:?]
   at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455) ~[?:?]
   at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) ~[?:?]
   at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379) ~[service.jar:?]
   at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337) ~[service.jar:?]
   at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209) ~[service.jar:?]
   at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[service.jar:?]
   at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[service.jar:?]
   at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[service.jar:?]
   at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[service.jar:?]
   at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[service.jar:?]
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[service.jar:?]
   at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[service.jar:?]
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[service.jar:?]
   at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[service.jar:?]
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[service.jar:?]
   at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[service.jar:?]
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[service.jar:?]
   at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[service.jar:?]
   at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517) ~[service.jar:?]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
   at java.lang.Thread.run(Thread.java:1589) ~[?:?]

我在堆栈跟踪中看到 okhttp 正在调用

connectTls
,鉴于应该禁用 SSL,这似乎很可疑。

我的连接工厂设置代码:

ConnectionFactory()
  .apply {
    host = "rabbit-external"
    port = 5672
    username = "someUser"
    password = "somePassword"
  }

对于其他上下文,Kotlin 应用程序和 RabbitMQ 实例都在 Docker Compose 堆栈中一起运行。

我的问题基本上是:为什么要尝试使用 TLS?为什么在客户端从未启用 SSL 时会涉及到它?

java rabbitmq
© www.soinside.com 2019 - 2024. All rights reserved.