简体   繁体   English

org.springframework.web.client.ResourceAccessException:“https://[myendpoint]”的 GET 请求出现 I/O 错误

[英]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配置。

  1. Check the cert validity at Leaf Level检查叶子级别的证书有效性
  2. Check the cName is matching with endpoint or not if not you might hav to disable host name checking检查 cName 是否与端点匹配,如果不是,您可能必须禁用主机名检查
  3. Try enabling ssl logging, javax.net.debug=ssl/all尝试启用 ssl 日志记录, javax.net.debug=ssl/all

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.springframework.web.client.ResourceAccessException:“http://localhost:8080/”的 GET 请求上的 I/O 错误:连接被拒绝:连接 - org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8080/": Connection refused: connect Http 使用 RestTemplate 获取请求 - org.springframework.web.client.ResourceAccessException - Http Get request with RestTemplate - org.springframework.web.client.ResourceAccessException ResourceAccessException:POST 请求上的 I/O 错误 - ResourceAccessException: I/O error on POST request ResourceAccessException:POST 请求的 I/O 错误 - ResourceAccessException: I/O error on POST request ResourceAccessException: POST 请求上的 I/O 错误 .. 读取超时错误 - ResourceAccessException: I/O error on POST request for .. read timed out ERROR 我收到错误 org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request - I am getting the Error org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request 我收到错误消息“ org.springframework.web.client.HttpClientErrorException $ BadRequest:400错误请求” - I'm getting error “org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request” 当我在谷歌 kubernetes 引擎上运行我的应用程序时,我得到 org.springframework.web.client.HttpClientErrorException$Forbidden: 403 Forbidden 错误 - When I run my application on google kubernetes engine, i get org.springframework.web.client.HttpClientErrorException$Forbidden: 403 Forbidden error RestTemplate.postForObject - 错误:org.springframework.web.client.HttpClientErrorException:400错误请求 - RestTemplate.postForObject - Error: org.springframework.web.client.HttpClientErrorException: 400 Bad Request org.springframework.web.client.HttpClientErrorException:400错误的请求 - org.springframework.web.client.HttpClientErrorException: 400 Bad Request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM