gpt4 book ai didi

java - 获取 sbt 插件时为 “PKIX path building failed” 和 “unable to find valid certification path to requested target”

转载 作者:太空宇宙 更新时间:2023-11-03 14:22:55 24 4
gpt4 key购买 nike

我已经使用自制软件安装了 java (11 - openjdk 11.0.2)、scala (2.13.1) 和 sbt (1.3.4)。然后我尝试将证书添加到 java 的 keystore :

keytool -import -alias "my-cert" -keystore "$JAVA_HOME/lib/security/cacerts" -file ~/my-cert.cert

但是当我尝试使用 sbt(通过 idea 或从控制台)时,我遇到了这些错误:

:::: ERRORS Server access Error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo1.maven.org/maven2/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.pom

Server access Error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo1.maven.org/maven2/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.jar

Server access Error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/maven-snapshots/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.pom

Server access Error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/maven-snapshots/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.jar

我还尝试为 repo.scala-sbt 添加证书(https://stackoverflow.com/a/54746436):

keytool -import -alias "scala-sbt" -keystore "$JAVA_HOME/lib/security/cacerts" -file ~/scala-sbt.cert

但这也没有帮助。我该如何解决这个问题?


试过这个:

   keytool -importcert -trustcacerts -alias "my-cert" -keystore "$JAVA_HOME/lib/security/cacerts" -file ~/my-cert.cert

这对


要连接到互联网,我使用 cisco anyconnect。按照建议将所有证书文件格式更改为 *.pem 但这也没有帮助

最佳答案

我建议将问题分为两部分:

1) 将所需的中间证书和根证书添加到 keystore 。然后,您可以使用简单的 Java 应用程序(如 SSLPoke)代替 sbt 来测试此步骤。

https://github.com/MichalHecko/SSLPoke .

2) 确保 sbt 使用正确的 keysotre。您可以使用 jvm 参数“-Djavax.net.ssl.trustStore”将 keystore 传递给应用程序

如果您的公司位于卸载 ssl 流量的防火墙后面,您可以使用本地人工服务器来缓解此问题。

关于java - 获取 sbt 插件时为 “PKIX path building failed” 和 “unable to find valid certification path to requested target”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59173360/

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