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
问题产生:
本地与测试环境下使用 apache的HttpClient访问第三方https域名下的接口可以正常请求,但上线到正式环境后进行请求时日志报错。
基本原因:
在jdk证书库里找不到该https域名的公钥证书,被jdk拒绝访问。
解决方法
如上所述,要解决这个问题的方法就是:
1、相信所有外来证书;
2、在jdk证书库里添加该域名的公钥证书。
以下对第二种方法进行相应陈述:
1、获取 HTTPS 域名的公钥证书,可以通过浏览器导出并命名为xxx.cer
2、上传证书到服务器上,记住上传的路径,最好是/root目录下。
3、进入到jdk目录下的jre\lib\security这个目录然后执行以下语句
keytool -import -alias cacerts -keystore cacerts -file /root/xxx.cer
输入密码 : changeit
最后确定: yes
- certification requested unable target validcertification requested unable target certification requested源码unable certificate problem issuer unable certificate validation according procedure certificates主机vcenter unable certificate connect expired unable certificate expired docker valid certificate validate because contain certificate unable issuer error certificate unable verify axios