gpt4 book ai didi

java - 在mobilefirst中调用java适配器时如何解决此错误 "java.security.cert.CertificateException:"?

转载 作者:太空宇宙 更新时间:2023-11-04 09:52:32 25 4
gpt4 key购买 nike

我目前正在开发 Mobile First 版本 8。在创建 Java 适配器以通过以下代码调用 api 时,我收到错误“java.security.cert.CertificateException:PKIX 路径构建失败移动优先 Java 适配器错误”

@GET
@Path("/unprotected")
@Produces(MediaType.TEXT_PLAIN)
@OAuthSecurity(enabled = false)
public String unprotected() {
StringBuffer content = new StringBuffer();
try {
URL url = new URL("Some Url");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
BufferedReader in =new BufferedReader(new inputStreamReader(con.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
content.append(inputLine);

logger.info("MYFind Data" + content.toString());
in.close();

con.disconnect();
} catch (Exception e) {
logger.info("" + e.getMessage());
}
return content.toString();
}

在“C:\Users\Admin\MobileFirst-8.0.0.0\mfp-server\usr\servers\mfp\logs\messages.log”的日志文件中发现错误

E CWPKI0022E:SSL 握手失败:从目标主机发送了具有SubjectDN CN=*.openweathermap.org、OU=EssentialSSL 通配符、OU=域控制验证的签名者。可能需要将签名者添加到本地信任存储 C:/Users/Admin/MobileFirst-8.0.0.0/mfp-server/usr/servers/mfp/resources/security/key.jks(位于 SSL 配置别名 defaultSSLConfig 中)。 SSL 握手异常的扩展错误消息为:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

00000619 com.wether.JavaAdapterMainResource I java.security.cert.CertificateException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

最佳答案

错误消息非常清楚地阐明了问题:

SSL HANDSHAKE FAILURE: A signer with SubjectDN CN=*.openweathermap.org, OU=EssentialSSL Wildcard, OU=Domain Control Validated was sent from the target host. The signer might need to be added to local trust store C:/Users/Admin/MobileFirst-8.0.0.0/mfp-server/usr/servers/mfp/resources/security/key.jks

来自端点的证书由“COMODO”签名。验证 Liberty 服务器中配置的 Java cacert 和/或 keystore 是否具有根 CA。如果没有,请添加。

关于java - 在mobilefirst中调用java适配器时如何解决此错误 "java.security.cert.CertificateException:"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54531303/

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