内部开发网管包插件,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 target
需要导入对端证书,参考
http://blog.csdn.net/ybygjy/article/details/12147281 将对端文件导入jdk的cacerts证书库,对端提供pem证书,首先转换为der文件
openssl x509 -outform der -in cacrt.pem -out omccertificate.der
然后再导入证书库
keytool -import -alias omcformone -file omccertificate.der -trustcacerts -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit
问题解决。
附:如果对端是网站怎么导出证书?