1.证书错误
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2.生成客户端证书
openssl x509 -in <(openssl s_client -connect 192.168.11.19:8101 -prexit 2>/dev/null) -out 11_19_8101.crt
会在当前文件夹下生成11_19_8101.crt;如果是其它网址,相应的替换192.168.11.19:8101
3.证书导入到jvm
到{jdk_home}/jre/bin下,执行下面命令,密码输入changeit,后面提示是否信任该证书,输入Y
keytool -keystore ..\lib\security\cacerts -import -alias 192.168.11.19 -file /home/11_19_8101.crt
参考资料:
ssl - Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target - Stack Overflow