gradle Java默认证书丢失,即使它们在正确的位置,我没有实际使用任何

5uzkadbs  于 2023-05-29  发布在  Java
关注(0)|答案(1)|浏览(205)

任何时候我运行任何试图运行纯Java代码的程序(编码程序,ENV和一些基于它的编译程序)。它不会影响正在使用Java的应用程序(tho)
例如,当我尝试运行Gradle时,它会给我一个错误:

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

其他程序也一样
我已经卸载了所有的JDK和JRE文件,并重新安装了它们,并更改了JAVA_HOME和路径变量,但它仍然给我那个错误。我没有连接到任何SSL或其他自定义服务器,只是默认的java服务器,所以我不明白为什么cacerts文件中的默认证书不起作用。我想,但我不确定,它发生在Java更新的时候。从那以后,大概2个月前,就这样了
顺便说一句,我确实尝试使用keytool,但它需要一个.cer文件,我在Java 17中没有(据我所知)
这是痕迹

javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
    at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
    at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:201)
    at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
    at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
    at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
    at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:589)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:187)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
    at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:308)
    at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:243)
    at net.minecraftforge.installer.DownloadUtils.downloadManifest(DownloadUtils.java:307)
    at net.minecraftforge.installer.json.Util.getVanillaVersion(Util.java:73)
    at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:86)
    at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:423)
    at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:175)
    at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:147)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
    at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
    at java.base/sun.security.validator.Validator.validate(Validator.java:264)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:638)
    ... 24 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:146)
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:127)
    at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
    ... 29 more
Failed to download version manifest, can not find server jar URL.
rqcrx0a6

rqcrx0a61#

这是注册表和windows文件的问题。由于某种原因,一些程序在System32文件夹中创建了一个不必要的文件。只需从C:\Windows\System32\drivers\etc目录中删除主机/hosts和任何类似名称的文件,它就会被修复!!!

相关问题