• jdk1.7访问https报javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure问题解决


    本地jdk版本java version "1.8.0_31",代码中已对https做了相应处理:信任所有来源证书,运行正常;上包到服务器(服务器jdk版本java version "1.7.0_80"),报以下ssl异常

    javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
    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.getInputStream(HttpURLConnection.java:1301)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    

      

    解决方案:
    更换jdk中jce的jar包

    网上资料说这个应该是旧版本jdkjce中安全机制的bug,要去oracle官网下载对应的jce包替换jdk中的jce包

    jce所在jdk的路径: %JAVA_HOME%jrelibsecurity里的local_policy.jar,US_export_policy.jar

    JDK7 http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

    JDK8 http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

    云盘:https://pan.baidu.com/s/1Klr3MS8yhpEnlj7nYM1OYw

  • 相关阅读:
    [Ubuntu]更改所有子文件和子目录所有者权限
    [ubuntu] 外挂硬盘
    HashMap、Hashtable、ConcurrentHashMap的原理与区别
    [Pytorch笔记] scatter_
    [The Annotated Transformer] Iterators
    [python 笔记] __iter__迭代器
    [负数在内存中的存储] 0x80000000 = -2147483648
    [NLP] The Annotated Transformer 代码修正
    [pytorch笔记] 调整网络学习率
    numpy中双冒号的作用
  • 原文地址:https://www.cnblogs.com/remember-forget/p/10271248.html
Copyright © 2020-2023  润新知