gpt4 book ai didi

java - PKIX 路径构建失败错误在 Oracle JDK 上仍然存在

转载 作者:行者123 更新时间:2023-11-30 10:48:15 27 4
gpt4 key购买 nike

问题

编辑:这个问题的第一个版本给人的印象是我的问题与 Maven 有关。我重新措辞以更加关注 JDK。

在尝试使用 Java 联系任何支持 SSL 的服务时,我得到了 sun.security.provider.certpath.SunCertPathBuilderException: PKIX path building failed。对其他相关问题的回答并没有阻止我的错误。

错误出现在任何 Maven 任务中,如下所示...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project foundation-ddl: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.apache.maven:maven-plugin-api:jar:2.0.6: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to example (https://example.com/artifactory/repo/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

...或者如果我执行一个连接 SSL 服务的 jar

$ java -jar atlassian-bamboo-agent-installer-5.9.7.jar http://...

INFO | jvm 1 | 2016/03/09 10:59:21 | 2016-03-09 10:59:21,381 FATAL [WrapperSimpleAppMain] [AgentBootstrap] Exiting due to fatal exception.
INFO | jvm 1 | 2016/03/09 10:59:21 | javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:535)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:403)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
INFO | jvm 1 | 2016/03/09 10:59:21 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:118)
INFO | jvm 1 | 2016/03/09 10:59:21 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:103)
INFO | jvm 1 | 2016/03/09 10:59:21 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:94)
INFO | jvm 1 | 2016/03/09 10:59:21 | at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:95)
INFO | jvm 1 | 2016/03/09 10:59:21 | at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:41)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | 2016/03/09 10:59:21 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2016/03/09 10:59:21 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 1 | 2016/03/09 10:59:21 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 1 | 2016/03/09 10:59:21 | at java.lang.Thread.run(Thread.java:745)
INFO | jvm 1 | 2016/03/09 10:59:21 | Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我尝试了什么

  1. 这些答案:Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?
  2. 我用了InstallCert访问出现异常的主机,并成功将证书添加到信任库中。为了验证,IntelliCert 打印No errors, certificate is already trusted,但是这并没有阻止错误。
  3. 事实上第 2 步没有阻止错误让我认为(在 Maven 的情况下)Maven 使用了不同的信任库。我使用了“How to change maven java home”的答案' 以确保 Maven 至少使用了我正在考虑的相同 Java 实例(在 Oracle JDK 1.8 中)。这并没有改变任何东西,所以我现在正在查看 JDK。

解决此问题的众所周知的方法似乎不起作用。 如何停止错误、修复我的 JDK 并最终再次使用支持 SSL 的服务?

最佳答案

经过徒劳的调查后,我最终清除并重新安装了 JDK,从而解决了问题。 JDK 的版本没有改变。对于那些通过 Google 访问此问题页面的人,只需这样做即可避免恐惧。

关于java - PKIX 路径构建失败错误在 Oracle JDK 上仍然存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35876440/

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