【解决PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:... 】问题

issue:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is java.lang.RuntimeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
最近项目上测试环境的elasticsearch证书过期了。我重新生成了新的self-signed certificate。发现有springboot微服务的接口报了上面提到error。这个接口是接连elasticsearch,并且查询数据展示在页面上。
我马上意识到了是因为我更新了新的cert。还没有import rootCA.crt到jdk的cacerts keystore里面。
用下面的命令:

sudo keytool -import -alias newCert -file  /folder/rootCA.crt -keystore  /usr/lib/jvm/zulu11-ca/lib/security/cacerts

folder/rootCA.crt 是证书的路径
/usr/lib/jvm/zulu11-ca/lib/security/cacerts 是jdk keystore的路径,根据自己服务器的目录更改。

然后再重启微服务。问题得到解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值