【问题标题】:gradlew unable to find valid certification path to requested targetgradlew 无法找到请求目标的有效认证路径
【发布时间】:2019-01-04 07:56:03
【问题描述】:

我正在使用 Minecraft Forge 进行改装。对于那些不知道 Forge 是什么的人来说,它是一个防止模组破坏 Minecraft 源代码并帮助模组共存的程序。它还包含一个开发工具包,因此 Java 程序员可以制作他们自己的模组(我假设您知道 Minecraft 是什么)。我最近购买了一个新版本的 Forge,并试图创建一个新的工作区。但是,每当我在 Windows 命令提示符下运行以下命令时:

gradlew setupDecompWorkspace

我得到以下输出:

Downloading https://services.gradle.org/distributions/gradle-2.14-bin.zip

Exception in thread "main" 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 java.base/sun.security.ssl.Alerts.getSSLException(Alerts.java:198)
    at java.base/sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1969)
    at java.base/sun.security.ssl.Handshaker.fatalSE(Handshaker.java:318)
    at java.base/sun.security.ssl.Handshaker.fatalSE(Handshaker.java:312)
    at java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1846)
    at java.base/sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1655)
    at java.base/sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:260)
    at java.base/sun.security.ssl.Handshaker.processLoop(Handshaker.java:1086)
    at java.base/sun.security.ssl.Handshaker.processRecord(Handshaker.java:1020)
    at java.base/sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1137)
    at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1074)
    at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    at java.base/sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1429)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
    at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1563)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1491)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:236)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
    at org.gradle.wrapper.Download.download(Download.java:44)
    at org.gradle.wrapper.Install$1.call(Install.java:59)
    at org.gradle.wrapper.Install$1.call(Install.java:46)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:46)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
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:385)
    at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:290)
    at java.base/sun.security.validator.Validator.validate(Validator.java:264)
    at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:343)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:226)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:133)
    at java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1825)
    ... 23 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:141)
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
    ... 29 more

我尝试运行此命令来解决问题:

gradlew clean

但我得到了完全相同的错误!

我的 JAVA_HOME 变量设置为 C:\Program Files\Java\jdk-9。

编辑:我按照您的建议将 gradle 属性文件中的 https 更改为 http,它实际上开始工作了。但是,我现在收到 this 错误:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod 
(file:/C:/Users/James/.gradle/wrapper/dists/gradle-2.14-
bin/ahcidmhfbcpw2l6c6ohng55pk/gradle-2.14/lib/gradle-base-services-2.14.jar) 
to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of 
org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
To honour the JVM settings for this build a new JVM will be forked. Please 
consider using the daemon: 
https://docs.gradle.org/2.14/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'forge'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.ow2.asm:asm-debug-all:5.1.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve org.ow2.asm:asm-debug-all:5.1.
     > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.1/asm-debug-all-5.1.pom'.
        > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-debug-all/5.1/asm-debug-all-5.1.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.guava:guava:18.0.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.google.guava:guava:18.0.
     > Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/google/guava/guava/18.0/guava-18.0.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve net.sf.opencsv:opencsv:2.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve net.sf.opencsv:opencsv:2.3.
     > Could not get resource 'https://jcenter.bintray.com/net/sf/opencsv/opencsv/2.3/opencsv-2.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/net/sf/opencsv/opencsv/2.3/opencsv-2.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.cloudbees:diff4j:1.1.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.cloudbees:diff4j:1.1.
     > Could not get resource 'https://jcenter.bintray.com/com/cloudbees/diff4j/1.1/diff4j-1.1.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/cloudbees/diff4j/1.1/diff4j-1.1.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.github.abrarsyed.jastyle:jAstyle:1.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.github.abrarsyed.jastyle:jAstyle:1.3.
     > Could not get resource 'https://jcenter.bintray.com/com/github/abrarsyed/jastyle/jAstyle/1.3/jAstyle-1.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/github/abrarsyed/jastyle/jAstyle/1.3/jAstyle-1.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve net.sf.trove4j:trove4j:2.1.0.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve net.sf.trove4j:trove4j:2.1.0.
     > Could not get resource 'https://jcenter.bintray.com/net/sf/trove4j/trove4j/2.1.0/trove4j-2.1.0.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/net/sf/trove4j/trove4j/2.1.0/trove4j-2.1.0.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.github.jponge:lzma-java:1.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.github.jponge:lzma-java:1.3.
     > Could not get resource 'https://jcenter.bintray.com/com/github/jponge/lzma-java/1.3/lzma-java-1.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/github/jponge/lzma-java/1.3/lzma-java-1.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.nothome:javaxdelta:2.0.1.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.nothome:javaxdelta:2.0.1.
     > Could not get resource 'https://jcenter.bintray.com/com/nothome/javaxdelta/2.0.1/javaxdelta-2.0.1.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/nothome/javaxdelta/2.0.1/javaxdelta-2.0.1.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.code.gson:gson:2.2.4.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.google.code.gson:gson:2.2.4.
     > Could not get resource 'https://jcenter.bintray.com/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.github.tony19:named-regexp:0.2.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve com.github.tony19:named-regexp:0.2.3.
     > Could not get resource 'https://jcenter.bintray.com/com/github/tony19/named-regexp/0.2.3/named-regexp-0.2.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/com/github/tony19/named-regexp/0.2.3/named-regexp-0.2.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.apache.httpcomponents:httpclient:4.3.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve org.apache.httpcomponents:httpclient:4.3.3.
     > Could not get resource 'https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.apache.httpcomponents:httpmime:4.3.3.
 Required by:
     :forge:unspecified > net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT
  > Could not resolve org.apache.httpcomponents:httpmime:4.3.3.
     > Could not get resource 'https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.3.3/httpmime-4.3.3.pom'.
        > Could not HEAD 'https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.3.3/httpmime-4.3.3.pom'.
           > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 48.897 secs

看起来又出现了“找不到请求目标的有效证书路径”错误。我尝试过使用许多不同版本的命令,包括:

gradlew setupDecompWorkspace --refresh-dependencies

gradlew setupDecompWorkspace eclipse

gradlew setupDecompWorkspace eclipse --refresh-depencencies

这些都导致了相同的构建失败。有什么建议吗?

【问题讨论】:

  • 看起来您需要在您的信任存储中注册 SSL 证书。看到这个答案stackoverflow.com/questions/7219989/java-and-ssl-certificates
  • 是否为我的计算机分配了一个我一直使用的主要 SSL 证书,还是我必须从 GoDaddy 或 Verisign 等网站选择一个证书?如果我必须选择一个,这种项目推荐什么证书?另外,我如何注册该证书,我可以通过命令提示符注册吗?
  • 这是你的答案 --> minecraftforge.net/forum/topic/…

标签: java gradlew


【解决方案1】:

这可能是由于使用了没有最新 SSL 证书的过时 Java 版本造成的。见this thread

【讨论】:

    【解决方案2】:

    通过检查“[v] Override Workspace settings”然后单击(*)Specific Gradle Version 4.3.1,手动将“Gradle User Home”设置为我的 gradle 4.3.1 版本存储在硬盘上并单击“[v] 离线模式”

    【讨论】:

      猜你喜欢
      • 2021-12-04
      • 2015-02-13
      • 2019-10-15
      • 2021-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多