javax.net.ssl.SSLHandshakeException

遇到证书问题:
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
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 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.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.seedeer.common.util.HttpUtil.sendGet(HttpUtil.java:372)

    1.查看当前已经加入的java信任的证书

keytool -list -keystore /usr/java/jdk1.8.0_91/jre/lib/security/cacerts
#changeit
2.页面访问,导出证书

keytool -import -alias seed -keystore /usr/java/jdk1.8.0_91/jre/lib/security/cacerts -file ./seed.cer

原文地址:https://blog.51cto.com/ckl893/2426309

时间: 2024-08-26 03:09:03

javax.net.ssl.SSLHandshakeException的相关文章

javax.net.ssl.SSLHandshakeException(Cas导入证书)

一.报错: javax.net.ssl.SSLHandshakeException 二.原因分析:CAS部署时,常常要涉及到HTTPS的证书发布问题.由于在实验环境中,CAS和应用服务常常是共用一台PC机,它们跑在相同的JRE环境和Tomcat服务器上,因此忽略了证书的实际用途,一旦将CAS和应用分别部署在不同的机器上时,就晕了! 这里假设如下实验环境来说明相应的部署  机器A: 部署CAS服务  机器B: 部署OA应用 机器C: 用户浏览器端 1.由机器A上生成.keystore的证书文件,证

转:javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 解决方案

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 解决方案 这个是jdk导致的,jdk里面有一个jce的包,安全性机制导致的访问https会报错,官网上有替代的jar包,换掉就好了 目录 %JAVA_HOME%\jre\lib\security里的local_policy.jar,US_export_policy.jar JDK7 http://www.oracle.com/technetwo

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed

使用HttpClient4.3 调用https出现如下错误: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested

解决 Java 调用 Azure SDK 证书错误 javax.net.ssl.SSLHandshakeException

Azure 作为微软的公有云平台,提供了非常丰富的 SDK 和 API 让开发人员可以非常方便的调用的各项服务,目前除了自家的 .NET.Java.Python. nodeJS.Ruby,PHP 等语言都提供支持,详细的文档说明请参考: https://azure.microsoft.com/en-us/documentation/ 然而在使用过程中,以 Java 语言为例,在初始调用 Azure SDK/API 的时候大家会碰到类似下面的错误: [WARN] ServiceBusContrac

SSL/TLS的Handshake过程与javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure异常

转载自http://blog.csdn.net/taiyangdao/article/details/54707184 一.SSL/TLS的Handshake过程 在SSL/TLS的Handshake过程中,客户端与服务器之间需要交换参数,具体过程如下: 客户端提供其所支持的各种cipher suites(包含加密算法和Hash函数) 服务器从中选择自己也支持的cipher suite,并通知客户端,表明两者将以此进行数据传输 服务器同时将自己的数字证书(包括服务器名称.CA和公钥)作为标识符发

andorid HTTPS 不需要证书 VolleyEror: com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not fou

1.加证书(这里不说) 2.修改代码 import java.security.KeyManagementException;import java.security.NoSuchAlgorithmException;import java.security.SecureRandom;import java.security.cert.X509Certificate;import javax.net.ssl.HostnameVerifier;import javax.net.ssl.HttpsU

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

SSL握手失败:用JDK1.8做发邮件的功能遇到这种问题处理方式是:将目录 %JAVA_HOME%\...\jre\lib\security里的local_policy.jar,US_export_policy.jar两个包替换成1.7版本的下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html 原因:可能是JDK1.8 处理SSL安全机制有问题

HttpClient_javax.net.ssl.SSLHandshakeException: sun.security.validator 问题解决,与环境有关

用httpclient访问https 资源时,会出现异常,与环境也有关系,有些机器请求正常. javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification p

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection

客户端向服务器发送数据时,份两种情况,SSL单向验证和SSL双向验证 1.SSL单向验证时 代码如下: Java代码   import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.a