Spring Boot Feign客户端:为什么是HTTP调用时SSL错误



弹簧启动版本:1.5.21.Release

服务提供商和服务呼叫者都是同一弹簧启动版。

我想知道的是,为什么它是一个ssl错误,当它调用http serivce?

下面是堆栈跟踪的一部分:

Caused by: feign.RetryableException: Unrecognized SSL message, plaintext connection? executing PUT http://serivce-name/service/api
    at feign.FeignException.errorExecuting(FeignException.java:67)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:104)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
    at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
    at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
    at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
    ... 27 common frames omitted
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
    at sun.security.ssl.InputRecord.read(InputRecord.java:527)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
    at feign.Client$Default.convertAndSend(Client.java:133)
    at feign.Client$Default.execute(Client.java:73)

我也有同样的问题。我将eureka用于discovery serverfeign client在服务之间连接。我的问题是在Services'Eureka配置中。

源服务配置为仅使用http协议:

eureka:
  instance:
    secure-port-enabled: false
    non-secure-port-enabled: true

目标服务配置为使用https协议:

eureka:
  instance:
    secure-port-enabled: true
    non-secure-port-enabled: false

在此配置中,源服务器试图通过http协议连接到目标服务器,但是该目标是使用https配置的。

所以,我更改了目标配置,就像源一样!

相关内容

  • 没有找到相关文章

最新更新