PKIX 路径构建失败 - 无法找到请求目标的有效证书路径

问题描述 投票:0回答:1

JVM 信息:Oracle 公司 - 1.8.0_51 - 25.51-b03 java.net.preferIPv4Stack=true 找到java版本1.8.0_51 添加 Lets Encrypt 根证书作为额外信任 目标目录: . 数据由 CreeperHost 镜像,网址为 https://www.creeperhost.net/ 提取主罐子: 提取成功 考虑我的世界服务器jar

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
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker.process_record(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    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.SimpleInstaller.main(SimpleInstaller.java:128)
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 sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 25 more

下载版本清单失败,找不到服务器 jar URL。 安装过程中出现错误

/* 我已经尝试将 creeperhosts 证书添加到 java 的 cacert 中。请记住,我对这件事没有任何经验......:DDDDD 所以我只能按照你的指示进行。 */

java ssl minecraft-forge
1个回答
1
投票

花了一些时间尝试找到解决方案后,我打开了安装程序的代码并找到了安装程序尝试用来下载 Minecraft 服务器文件的 URL。

    public static final String MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest.json";

因此您必须从此链接导出根证书,然后导入到您的 JRE 受信任的证书文件夹中。证书名称为“DigiCert Global Root G2”。执行此操作的命令是:

 keytool.exe -import -alias digicert -keystore 'C:\Program Files\Java\jre1.8.0_51\lib\security\cacerts' -file 'C:\Users\[you user here]\Downloads\DigiCert Global Root G2.crt'

通常密钥库的密码是“changeit”(不带引号)。

现在您可以运行安装程序,它应该可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.