[REST .0 - 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]
使用java的httpclient调用https的api时,可能报error,这时的解决方法是:
1. chrome中到处cer证书:
2. 找到jdk 安装路径, 我的centos的路径为/usr/java
3. 进入 /usr/java/bin,使用keytool导入相应https证书
./keytool -import -alias ${aliasName} -keystore ${java_home}/jre/lib/security/cacerts -file ${cer-file-path}
./keytool -import -alias spark -keystore /usr/java/jre/lib/security/cacerts -file /home/wbxbuilds/spark.crt