【问题标题】:Remote host closed connection during handshake for SOAP ConnectionSOAP 连接握手期间远程主机关闭连接
【发布时间】:2019-07-19 20:59:58
【问题描述】:

我正在尝试连接到 SOAP 端点。

 public SOAPMessage getRequestObjectResponse(SOAPMessage message) {
    System.setProperty("https.protocols", "TLSv1");
    try {
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();

        // Send SOAP Message to SOAP Server
        return soapConnection.call(message, config.getBaseUrl());
    } catch (SOAPException ex) {
        Logger.getLogger(SOAPWebServiceTemplate.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}

使用上面的我不断收到以下错误

在 java.lang.Thread.run(未知来源)[na:1.8.0_191] 引起:com.sun.xml.messaging.saaj.SOAPExceptionImpl:消息发送失败 在 com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:297) ~[saaj-impl-1.5.0.jar!/:na] 在 com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:160) ~[saaj-impl-1.5.0.jar!/:na] ...省略了59个常用框架 引起:javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接 在 sun.security.ssl.SSLSocketImpl.readRecord(未知来源)~[na:1.8.0_191] 在 sun.security.ssl.SSLSocketImpl.performInitialHandshake(未知来源)~[na:1.8.0_191] 在 sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)~[na:1.8.0_191] 在 sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)~[na:1.8.0_191] 在 sun.net.www.protocol.https.HttpsClient.afterConnect(未知来源)~[na:1.8.0_191] 在 sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[na:1.8.0_191] 在 sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(未知来源)~[na:1.8.0_191] 在 sun.net.www.protocol.http.HttpURLConnection.getOutputStream(未知来源)~[na:1.8.0_191] 在 sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source) ~[na:1.8.0_191] 在 com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:252) ~[saaj-impl-1.5.0.jar!/:na] ...省略了60个常用框架 原因:java.io.EOFException:SSL 对等体错误关闭 在 sun.security.ssl.InputRecord.read(未知来源)~[na:1.8.0_191] ... 省略了 70 个常用帧

我做了一个curl -v 并使用这个website ssllabs 检查了网址的详细信息

卷曲信息如下

* Expire in 0 ms for 6 (transfer 0x181648d20a0) * Expire in 1 ms for 1 (transfer 0x181648d20a0) * Expire in 2 ms for 1 (transfer 0x181648d20a0) * Expire in 2 ms for 1 (transfer 0x181648d20a0) * Expire in 3 ms for 1 (transfer 0x181648d20a0) * Expire in 3 ms for 1 (transfer 0x181648d20a0) * Expire in 5 ms for 1 (transfer 0x181648d20a0) * Trying some_ip ... * TCP_NODELAY set * Expire in 200 ms for 4 (transfer 0x181648d20a0) * Connected to url_not_disclosed (some_ip) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: C:\Users\Developer\Downloads\CURL\curl-7.64.0-win64-mingw\bin\curl-ca-bundle.crt CApath: none * TLSv1.3 (OUT), TLS handshake, Client hello (1): * OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to url_not_disclosed:443 * Closing connection 0 curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to url_not_disclosed:443

以下sslab的详细信息

【问题讨论】:

    标签: java ssl curl


    【解决方案1】:

    所以 SSL 3 通常在 java 1.8 中被禁用,我要做的就是启用它。

    1. 转到您的 JAVA_HOME 目录,转到 JAVA_HOME\lib\security\
    2. 使用任何文本编辑器打开 java.security 文件
    3. 在该文件中找到 jdk.certpath.disabledAlgorithms 并将其注释掉

    【讨论】:

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