gpt4 book ai didi

java - validator 异常 : No trusted certificate found in java

转载 作者:行者123 更新时间:2023-12-02 05:38:30 25 4
gpt4 key购买 nike

当使用 p12 文件从 Java 服务器尝试 Apple 推送通知时,出现错误。我的 p12 文件或 Java 代码有问题吗?

run:
@:theodore nonis
C=IN, CN=Apple Development IOS Push Services: com.ducont.myPushApp, UID=com.ducont.myPushApp
theodore nonis
ok
init Stores...
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1107)
at javatest.Main.APNSender(Main.java:88)
at javatest.Main.main(Main.java:114)
Caused by: sun.security.validator.ValidatorException: No trusted certificate found
at sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:304)
at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:107)
at sun.security.validator.Validator.validate(Validator.java:218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
... 9 more
BUILD SUCCESSFUL (total time: 2 seconds)

最佳答案

针对 Windows 尝试以下步骤:

从这里下载 jar https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

将 local_policy.jar 和 US_export_policy.jar 复制到 $JAVA_HOME/jre/lib/security (注意:这些 jar 已经存在,因此您必须覆盖它们)。

然后重新启动您的应用程序以消除此异常。

关于java - validator 异常 : No trusted certificate found in java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10749803/

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