gpt4 book ai didi

java - WSClient 和 SSL

转载 作者:太空宇宙 更新时间:2023-11-03 13:51:10 29 4
gpt4 key购买 nike

在 Play 2.4.3 网络应用程序中,我需要使用 WSClient 通过 HTTPS 调用其他服务。我关注了the article但出现错误:

play.api.libs.ws.ssl.CompositeCertificateException: No trust manager was able to validate this certificate chain: # of exceptions = 1

CompositeCertificateException 中的异常:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

负责 SSL 的 application.conf 部分:

play.ws.ssl {
trustManager = {
stores = [
{ type : "PEM", path : "C:/A/B/globalsign.crt" }
]
}
}

这里有什么问题吗?

最佳答案

我通过以下步骤解决了这个问题:

  • 运行 InstallCert.java生成 jssecacerts 文件。
  • application.conf 中添加文件路径。

配置示例:

play.ws.ssl {
trustManager = {
stores = [
{path: "C:/A/B/jssecacerts"}
{path: ${java.home}/lib/security/cacerts}
]
}
}

关于java - WSClient 和 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44681364/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com