收藏
回答

SSLHandshakeException: Remote host closed connecti

我们生产环境,在微信支付时,抛出异常:(用的是CloseablehttpClient连接,这是个偶发现象)

System Exception:javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
    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 org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:373)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
    at com.ms.config.wx.sdk.WeChatUtil.processHttpPost(WeChatUtil.java:555)
    at com.ms.config.wx.sdk.WeChatUtil.unifiedorder(WeChatUtil.java:135)
    at com.ms.tpp.service.handler.wechat.WechatMiniProgramPaymentServiceImpl.pay(WechatMiniProgramPaymentServiceImpl.java:78)

网上查了下设置系统参数,System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");升级JDK版本等

但这是个偶发现象,如果可以都可以,如果不可以都不可以,应该不是上面的方法能解决的。有大侠遇到过吗?要怎样解决呢?

最后一次编辑于  2019-10-15
回答关注问题邀请回答
收藏

2 个回答

  • Jack
    Jack
    2023-05-23

    我也遇到了一样的问题

    2023-05-23
    有用
    回复 1
    • jason
      jason
      03-14
      解决了吗
      03-14
      回复
  • A婷婷婷婷。
    A婷婷婷婷。
    2019-11-25

    你好,你的问题解决了么?我也遇到了一样的问题

    2019-11-25
    有用
    回复 1
    • jason
      jason
      03-14
      解决了吗
      03-14
      回复
登录 后发表内容
问题标签