HTTPS请求不被信用

  • 投稿人: anan
  • 发布时间: 2021-08-25 16:00:55
  • 阅读: 287
  • 收藏: 16
  • 点赞: 1
  • 评论: 0

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
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证书,不被JDK信赖

那只能把证书注入到JDK中,keytool是JDK自带的

切换到jre的/lib/security/下

 

 

 

keytool -import -alias abc -keystore cacerts -storepass changeit  -file C:\downpath\xxx.cer

 

然后回车: 输入 “是” 就能导入成功

 

然后执行程序访问即可

 

来源  灰信网