首页 > 解决方案 > 由于未解决的依赖关系,无法创建新的 Play 项目 - SunCertPathBuilderException:无法找到有效的认证

问题描述

我正在尝试第一次创建新的游戏项目。由于与https://repo.typesafe.com/ *相关的错误 sun.security.validator.ValidatorException 我不能。如何添加证书?

我在 mac 上安装了 sbt 并运行以下命令

sbt new playframework/play-java-seed.g8
sbt run

实际结果是

:: problems summary ::
:::: ERRORS
    Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/9/jars/oss-parent.jar

    Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.apache/apache/18/jars/apache.jar

...

[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.typesafe.play:sbt-plugin:2.7.2 (scalaVersion=2.12, sbtVersion=1.0)
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.typesafe.play:sbt-plugin:2.7.2 (scalaVersion=2.12, sbtVersion=1.0) (/Users/dzejn/Documents/Development/PlayTrials/play-samples-play-java-hello-world-tutorial/project/plugins.sbt#L1-2)
[warn]        +- default:play-samples-play-java-hello-world-tutorial-build:0.1.0-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.typesafe.play#sbt-plugin;2.7.2: Resolution failed several times for dependency: com.typesafe.play#sbt-plugin;2.7.2 {compile=[default(compile)]}:: 
[error]     typesafe-ivy-releases: unable to get resource for com.typesafe.play#sbt-plugin;2.7.2: res=https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.2/ivys/ivy.xml: 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
[error]     sbt-plugin-releases: unable to get resource for com.typesafe.play#sbt-plugin;2.7.2: res=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.2/ivys/ivy.xml: 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
[error] 
[error]     at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:332)
[error]     at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error]     at sbt.internal.librarymanagement.IvyActions$$$Lambda$2480/1497726062.apply(Unknown Source)
[error]     at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)

我正在使用 macOS、sbt 1.2.8、java 1.8.0_45、sbt 新安装的 brew。我没有 JAVA_HOME/jre/lib/security/cacerts 目录,我也不支持代理,似乎与针对类似问题提出的解决方案相关。

谢谢

标签: javaplayframeworksbt

解决方案


我正在使用 macOS、sbt 1.2.8、java 1.8.0_45、sbt 新安装的 brew。

我的猜测是 Java 1.8.0_45 太旧了。我当前使用的是 1.8.0_212。您可以从https://adoptopenjdk.net/获取一个或使用类似https://sdkman.io/的内容。


推荐阅读