spring - Websphere - 休息服务 - 证书链接错误
问题描述
我正在尝试从我的应用程序连接 Rest 服务。我的应用程序被部署到 WAS 服务器。
我正在使用 Spring RestTemplate 来消费其余服务,并且在我的本地 WAS 设置中一切正常。
但是,当我将代码部署到 QA 环境(较低的环境区域)时,我的日志文件中出现以下错误。
[4/30/18 17:18:22:355 EDT] 00000207 SystemErr R org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://host:port/resourcename": com.ibm.jsse2.util.j: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
java.security.cert.CertPathValidatorException: The certificate issued by CN=XXX Root CA, O="The XXX Services Group, Inc." is not trusted; internal cause is:
java.security.cert.CertPathValidatorException: Certificate chaining error; nested exception is javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.j: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
java.security.cert.CertPathValidatorException: The certificate issued by CN=XXX Root CA, O="The XXX Services Group, Inc." is not trusted; internal cause is:
java.security.cert.CertPathValidatorException: Certificate chaining error
[4/30/18 17:18:22:355 EDT] 00000207 SystemErr R at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:607)
[4/30/18 17:18:22:356 EDT] 00000207 SystemErr R at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
[4/30/18 17:18:22:357 EDT] 00000207 SystemErr R at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:357)
我已经使用签名者证书选项导入了端口和主机的证书,但问题仍未解决(还尝试导入根证书)。谁能让我知道可能是什么问题?
解决方案
正如错误所暗示的,这看起来像您使用的 JVM 不信任其中一个中间证书。
您需要检索整个证书链,而不仅仅是根 CA 证书和服务器证书。您可以使用浏览器或openssl
检索证书链。您的客户端 JVM 必须信任证书链中的每个证书。
推荐阅读
- r - 混淆矩阵中的“相同水平因素”错误
- splunk - Splunk 主机标头覆盖日志消息中的主机密钥
- sql - 如何将数据更改为 * 但只有单词的 50%
- php - laravel 返回数组到字符串的转换错误
- gatsby - i18n 出错(错误:您正在传递一个未定义的模块!请检查您传递给 i18next.use() 的对象)
- java - 为什么同步锁不适用于字符串连接的原因
- c++ - Makefile 不对文件使用隐式规则
- windows - appcmd.exe set config 不检查用户名或密码是否无效并设置它
- batch-file - 防止批处理修饰符在文件名中删除插入符号
- javascript - 如何导出作为 JavaScript (React) 函数中的参数的对象?