java maven 存储库 sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37710721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 02:42:12  来源:igfitidea点击:

maven repository sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:

javamaven

提问by user1539343

I have the fragment of pom.xml which tries to resolve the fitbit dependency:

我有 pom.xml 的片段,它试图解决 fitbit 依赖项:

<repositories>
        <repository>
            <name>FitBit GitHub Repo</name>
            <id>fitbit4j</id>
            <url>https://nexus.vanntett.net/content/repositories/fitbit/</url>
        </repository>
    </repositories>

I am getting the below error:

我收到以下错误:

Failed to collect dependencies at com.fitbit:fitbit4j:jar:1.0.26: Failed to read artifact descriptor for com.fitbit:fitbit4j:jar:1.0.26: Could not transfer artifact com.fitbit:fitbit4j:pom:1.0.26 from/to fitbit4j (https://nexus.vanntett.net/content/repositories/fitbit/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

I used these parameters in eclipse: -Dmaven.wagon.http.ssl.insecure=true - Dmaven.wagon.http.ssl.allowall=true

我在 eclipse 中使用了这些参数: -Dmaven.wagon.http.ssl.insecure=true - Dmaven.wagon.http.ssl.allowall=true

which didn't work.

这没有用。

Please help.

请帮忙。

Thanks

谢谢

回答by positivecrux

you need to enter your certificate inside java cacert file,Please make sure you are selecting root ca certicate not the last one in hierarchy.

您需要在 java cacert 文件中输入您的证书,请确保您选择的是 root ca certicate 而不是层次结构中的最后一个。

Thislink demonstrate it the best.

这个链接是最好的证明。

Step 1 : Download certificate Step 2 : store inside cacert

第 1 步:下载证书第 2 步:存储在 cacert 中

That is it! your problem resolved.

这就对了!你的问题解决了。

回答by Cristian Meneses

It seems like your JDK does not have the CA root for the SSL certificate from the repository.

您的 JDK 似乎没有存储库中 SSL 证书的 CA 根。

You can find a nice article hereabout downloading those certificates and adding it to your Java JDK.

您可以在此处找到一篇关于下载这些证书并将其添加到 Java JDK的好文章。

回答by Bipin Kumar

Check that run keytool -import.. command from jre which exists uder jdk. like this.

检查是否从存在 uder jdk 的 jre 运行 keytool -import.. 命令。像这样。

1.Open cmd as admin...

1.以管理员身份打开cmd...

  1. go to path: C:\Program Files\Java\jdk1.8.0_65\bin>

  2. run bellow command.

    keytool -import -noprompt -trustcacerts -alias certPen -file D:\certificates\ca-cert.pem -keystore "C:\Program Files\Java\jdk1.8.0_60\jre\lib\security\cacerts"

  1. 转到路径:C:\Program Files\Java\jdk1.8.0_65\bin>

  2. 运行下面的命令。

    keytool -import -noprompt -trustcacerts -alias certPen -file D:\certificates\ca-cert.pem -keystore "C:\Program Files\Java\jdk1.8.0_60\jre\lib\security\cacerts"

and if u facing problem of file not found then set your all permission from Right click on cacerts → choose properties → select Securit tab → Allow all permissions to all the Group and user names.

如果您遇到找不到文件的问题,则从右键单击 cacerts → 选择属性 → 选择安全选项卡 → 允许所有组和用户名的所有权限设置您的所有权限。