问题:
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
解决:
https 网址在浏览器是正常的,服务器的证书也是受信任的,但是Java 里边不行
Jre 里边的 证书跟操作系统里边的证书系统无关
解决办法:
- 改写TrustManager ,跳过认证,
- 把证书加入受信任的keystore 中,(本帖采用的)
- 下载 https 证书导出为 aaa.cer (下载cer 参考https://help.aliyun.com/knowledge_detail/40743.html)
or
密码:changeit - java 执行时 使用 -Djavax.net.ssl.trustStore=***/aaa.keystore -Djavax.net.ssl.trustStorePassword=****
- 下载 https 证书导出为 aaa.cer (下载cer 参考https://help.aliyun.com/knowledge_detail/40743.html)
参考:
https://help.aliyun.com/knowledge_detail/40743.html
http://www.blogjava.net/wangxinsh55/archive/2011/07/21/354785.html
https://stackoverflow.com/questions/875467/java-client-certificates-over-https-ssl