【问题标题】:ESB Mule 3.7.0 SSLHandshakeException: Remote host closed connection during handshake atESB Mule 3.7.0 SSLHandshakeException:远程主机在握手期间关闭连接
【发布时间】:2015-12-22 14:57:36
【问题描述】:

当我从客户端向 ESB 发送请求时,我正在运行 ESB Mule 3.7.0,我收到以下错误:

ERROR 2015-12-21 18:15:24,859 [[my-project].http.request.dispatch.443.41] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Remote host closed connection during handshake javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:953) ~[?:1.7.0_80]
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332) ~[?:1.7.0_80]
        at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:889) ~[?:1.7.0_80]
        at sun.security.ssl.AppInputStream.read(AppInputStream.java:102) ~[?:1.7.0_80]
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) ~[?:1.7.0_80]
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254) ~[?:1.7.0_80]
        at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) ~[commons-httpclient-3.1.jar:?]
        at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) ~[commons-httpclient-3.1.jar:?]
        at org.mule.transport.http.HttpServerConnection.readLine(HttpServerConnection.java:245) ~[mule-transport-http-3.7.0.jar:3.7.0]
        at org.mule.transport.http.HttpServerConnection.getRequestLine(HttpServerConnection.java:557) ~[mule-transport-http-3.7.0.jar:3.7.0]
        at org.mule.transport.http.HttpRequestDispatcherWork.run(HttpRequestDispatcherWork.java:67) ~[mule-transport-http-3.7.0.jar:3.7.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_80]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_80]
        at java.lang.Thread.run(Thread.java:745) [?:1.7.0_80] Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at sun.security.ssl.InputRecord.read(InputRecord.java:482) ~[?:1.7.0_80]
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934) ~[?:1.7.0_80]
        ... 13 more

我的https connecter配置如下:

<https:connector name="httpsConnector" doc:name="HTTP\HTTPS" clientSoTimeout="10000" cookieSpec="netscape" receiveBacklog="0" receiveBufferSize="0" sendBufferSize="0" serverSoTimeout="10000" socketSoLinger="0" validateConnections="true">
        <receiver-threading-profile maxThreadsActive="${connector.https.maxThreadsActive}" />
        <https:tls-key-store path="${tls.keystore.location}" keyPassword="${tls.keystore.password}" storePassword="${tls.keystore.password}"/>
        <https:tls-server path="${tls.keystore.location}" storePassword="${tls.keystore.password}"/>
</https:connector>

https:inbound-endpoint定义为:

<https:inbound-endpoint exchange-pattern="request-response" host="${httpInbound.secure.host}" port="${httpInbound.secure.port}" doc:name="HTTPS Service" path="${httpInbound.contextRoot}/${external.serviceName}" responseTimeout="${service.timeout}" connector-ref="httpsConnector">
          <mule-ss:http-security-filter realm="mule-realm"/>
          <mule-ss:authorization-filter requiredAuthorities="PUBLIC" />
</https:inbound-endpoint>

为什么我在握手时收到SSLHandshakeException: Remote host closed connection?有任何想法吗?

【问题讨论】:

    标签: java ssl jboss mule esb


    【解决方案1】:

    在 https 连接器配置中检查您的证书信息我已经使用了以下步骤并且它可以正常工作

      <http:request-config name="SharedHttpsRequestConfig" protocol="HTTPS">
         <tls:context>
            <tls:trust-store path="${tls.trust.store}" password="${tls.trust.store.password}"/>
            <tls:key-store path="${tls.trust.store}"  password="${tls.trust.store.password}" keyPassword="${tls.trust.store.key.password}"/>
        </tls:context>  
    </http:request-config> 
    

    然后我在我的流程中使用了上面的 https 连接器来调用 https 服务

        <http:request config-ref="SharedHttpsRequestConfig"
                       port="${https.port}" host="#[MYMAP.get('DOMAINS')]"
                        path="/api/${version}/${.url}"
                        parseResponse="false"   responseTimeout="${es.mule.http.timeout}"
                    method="POST" doc:name="Service">
    

    【讨论】:

      【解决方案2】:

      远程主机可能不喜欢您发送给它的内容,因此初始 TLS 握手失败。这可能有很多原因,例如:

      • 您没有连接到 SSL 服务
      • 服务器需要您不支持的 TLS 版本
      • 服务器需要您不支持的密码
      • 服务器需要您可能不使用的 SNI

      我认为无法根据您提供的信息提取确切原因。但是,由于服务器关闭了连接,我建议查看服务器端的错误(日志文件等)。您也可以尝试与其他客户端连接到服务器,以查看问题是否与您的客户端配置有关或更多与服务器配置有关。

      【讨论】:

        猜你喜欢
        • 2018-09-27
        • 1970-01-01
        • 2017-03-03
        • 2012-08-12
        • 2019-07-19
        • 2018-07-29
        • 2017-06-25
        相关资源
        最近更新 更多