[英]org.springframework.web.client.ResourceAccessException: I/O error on GET request for 'https://[myendpoint]'
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径;
I am working on a REST call from my windows development machine.我正在从我的 windows 开发机器上进行 REST 调用。
I have tried following the guidelines for adding a certificate in my java keystore in: "C:\Program Files (x86)\Java\jre1.8.0_271\lib\security\cacerts"我已尝试按照以下指南在我的 java 密钥库中添加证书:“C:\Program Files (x86)\Java\jre1.8.0_271\lib\security\cacerts”
Infact I have another JAVA directory in: C:\Program Files\Java\jre1.8.0_271\lib\security\cacerts事实上,我有另一个 JAVA 目录在:C:\Program Files\Java\jre1.8.0_271\lib\security\cacerts
I have tried storing my certificate in both keystores.我尝试将我的证书存储在两个密钥库中。
At the site, that is exposing a rest service, I save the certificate from my Google Chrome webbrowser在该站点上,即公开了 rest 服务,我从我的 Google Chrome 网络浏览器中保存了证书
...and under the details tab clicking on the "Copy to file" button. ...并在详细信息选项卡下单击“复制到文件”按钮。 I use the Certificate Export Wizard and pick the first "DER encoded binary x.509 (.CER)" option.我使用证书导出向导并选择第一个“DER 编码二进制 x.509 (.CER)”选项。
I give the certificate a name "mycert.cer".我将证书命名为“mycert.cer”。 Once I have it exported, I use the keytool command and add it to my JAVA keystore with the following command:导出后,我使用 keytool 命令并使用以下命令将其添加到我的 JAVA 密钥库中:
keytool -import -noprompt -trustcacerts -alias mycert -file "d:\MyCertificates\mycert.cer" -keystore "C:\Program Files (x86)\Java\jre1.8.0_271\lib\security\cacerts" -storepass changeit
I get a confirmation, that it is stored.我得到确认,它已被存储。
I try to invoke my a rest call and I get the same error.我尝试调用我的 rest 调用,我得到了同样的错误。 Can someone please clarify, what I need to do more?有人可以澄清一下,我还需要做什么? What am I missing?我错过了什么?
I am doing all this in admin mode (local adminstrator) on my developer machine.我在我的开发人员机器上以管理员模式(本地管理员)执行所有这些操作。
How you are trying to invoke the API?您如何尝试调用 API? Is it Spring RestTemplate
or Any other clients?是 Spring RestTemplate
还是其他客户端?
Please provide your RestTemplate
configurations.请提供您的RestTemplate
配置。
javax.net.debug=ssl/all
尝试启用 ssl 日志记录, javax.net.debug=ssl/all
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.