gpt4 book ai didi

javax.net.ssl.SSLHandshakeException : sun. 安全.validator.ValidatorException

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:26:35 28 4
gpt4 key购买 nike

以前,我可以成功地向 Web 服务发送请求并接收响应,但它现在返回以下异常。根据其他答案,我需要更新证书,但我需要知道为什么我现在收到此异常。另一个问题是,我可以找到我的 java_home 的地址,但我无法更新证书。

异常:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed

代码

URI uri = new URI("https", "xml.example.com", "/service/ServiceRequest.do", 
"serverName=www.example.com&xml="
...
+" ", null);

URL page = uri.toURL();
HttpsURLConnection conn = (HttpsURLConnection) page.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.connect();

最佳答案

问题是您正在尝试与 SSL 证书已过期的服务器通信。您收到异常的原因是因为 Java SSL 代码正在检查证书链,并注意到了这个问题。已过期的 SSL 证书不可信......并且不受默认证书 validator 的信任。

I can not renew the certificate ...

更新证书由网站所有者决定。如果不是您,那么您无能为力……除了绕过证书验证,这对 SSL 连接安全性不利。

关于javax.net.ssl.SSLHandshakeException : sun. 安全.validator.ValidatorException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23322676/

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