首页 > 其他 > 详细

工作日志,证书无效 unable to find valid certification path to requested target

时间:2019-09-27 10:06:42      阅读:302      评论:0      收藏:0      [点我收藏+]

工作日志,证书无效 unable to find valid certification path to requested target

最近被这个问题弄得头大。导致所有用到 se.transmode.gradle:gradle-docker:1.2 的项目全部都无法启动!也不知道为什么会这样,其他同事的项目却可以正常打包运行!花了大半天的时间终于折腾好了。

异常情况:

技术分享图片

异常日志:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'xxxx'.
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
    ... 91 more
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.github.jnr:jffi:[1.2.1, 1.3.0).
Required by:
    project : > se.transmode.gradle:gradle-docker:1.2 > com.github.docker-java:docker-java:0.9.0 > com.github.jnr:jnr-unixsocket:0.3 > com.github.jnr:jnr-ffi:1.0.3
    ... 110 more
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Failed to list versions for com.github.jnr:jffi.
    ... 136 more
Caused by: org.gradle.api.resources.ResourceException: Unable to load Maven meta-data from https://repo.maven.apache.org/maven2/com/github/jnr/jffi/maven-metadata.xml.
    ... 142 more
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not HEAD 'https://repo.maven.apache.org/maven2/com/github/jnr/jffi/maven-metadata.xml'.
    ... 149 more
Caused by: 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
    ... 168 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 190 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 196 more

解决思路

网上找了一些解决方法,都是导出证书后添加到本地。第一次遇到这个问题,也不知道从哪里导出证书。看到日志中提示Failed to list versions for com.github.jnr:jffi. 。开始怀疑是因为证书失效导致的错误,于是将maven仓库中jffi 的证书导入并添加到本地,重启IDEA后,还是失败了。一瞬间,迷茫了。开始尝试导入其他网址的证书;尝试换gradle docker plugin;连重启电脑的方法都用上了。折腾了好长时间,结果都是以失败告终。

最后又重新看了一遍日志 se.transmode.gradle:gradle-docker:1.2 > com.github.docker-java:docker-java:0.9.0 > com.github.jnr:jnr-unixsocket:0.3 > com.github.jnr:jnr-ffi:1.0.3 抱着try 一 try的心态导入了 jnr-ffi:1.0.3 的证书,结果成功了,心态蹦了。蹦了。了。

具体步骤

第一步:分析日志,列出证书失效的嫌疑jar。

第二步:进入maven 仓库(可能是私服),找到对应的jar页面。

第三步:导出证书到本地

技术分享图片

第四步:用管理员身份打开cmd窗口,执行./keytool -import -alias 别名 -keystore cacerts -file 证书地址 命令添加证书,提示“证书已添加到密钥库中”即可。

技术分享图片

第五步:重启IDEA

如果一次没有成功,可以把其他的嫌疑对象,都添加进来。

工作日志,证书无效 unable to find valid certification path to requested target

原文:https://www.cnblogs.com/itdragon/p/11592178.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!