美文网首页
SSLHandshakeException: No approp

SSLHandshakeException: No approp

作者: 寀菇凉的小蜜蜂 | 来源:发表于2021-05-10 22:14 被阅读0次

    现象描述

    系统:Centos7
    OpenJDK版本:java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64

    在使用微信支付或者其他https调用时报如下错误:

    javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
        at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98)
        at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:428)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
    

    原因:JDK版本问题,参考:https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8256682

    解决方案

    使用奇数版本的JDK(因为奇数版本经过了所有检验,偶数版本包含未检验的内容,可能有BUG),步骤:

    1. 卸载当前安装的OpenJDK
    yum remove java-1.8.0-openjdk*
    
    1. 查找可安装的版本
    [root@test001 ~]# yum --showduplicate list java* | grep 1.8.0
    java-1.8.0-openjdk.x86_64                   1:1.8.0.275.b01-0.el7_9     @updates
    java-1.8.0-openjdk-headless.x86_64          1:1.8.0.275.b01-0.el7_9     @updates
    java-1.8.0-openjdk.i686                     1:1.8.0.262.b10-1.el7       base
    java-1.8.0-openjdk.x86_64                   1:1.8.0.262.b10-1.el7       base
    java-1.8.0-openjdk.i686                     1:1.8.0.272.b10-1.el7_9     updates
    java-1.8.0-openjdk.x86_64                   1:1.8.0.272.b10-1.el7_9     updates
    java-1.8.0-openjdk.i686                     1:1.8.0.275.b01-0.el7_9     updates
    java-1.8.0-openjdk.x86_64                   1:1.8.0.275.b01-0.el7_9     updates
    java-1.8.0-openjdk.i686                     1:1.8.0.282.b08-1.el7_9     updates
    java-1.8.0-openjdk.x86_64                   1:1.8.0.282.b08-1.el7_9     updates
    java-1.8.0-openjdk.i686                     1:1.8.0.292.b10-1.el7_9     updates
    java-1.8.0-openjdk.x86_64                   1:1.8.0.292.b10-1.el7_9     updates
    ...
    
    
    1. 安装1.8.0.275版本
    yum install java-1.8.0-openjdk-1.8.0.275.b01-0.el7_9.x86_64
    

    相关文章

      网友评论

          本文标题:SSLHandshakeException: No approp

          本文链接:https://www.haomeiwen.com/subject/hxkcsftx.html