工做日誌,證書無效 unable to find valid certification path to requested target

工做日誌,證書無效 unable to find valid certification path to requested targetjava

最近被這個問題弄得頭大。致使全部用到 se.transmode.gradle:gradle-docker:1.2 的項目所有都沒法啓動!也不知道爲何會這樣,其餘同事的項目卻能夠正常打包運行!花了大半天的時間終於折騰好了。git

異常狀況:

異常日誌:

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;連重啓電腦的方法都用上了。折騰了好長時間,結果都是以失敗了結。github

最後又從新看了一遍日誌 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 的證書,結果成功了,心態蹦了。蹦了。了。docker

具體步驟

第一步:分析日誌,列出證書失效的嫌疑jar。apache

第二步:進入maven 倉庫(多是私服),找到對應的jar頁面。api

第三步:導出證書到本地socket

第四步:用管理員身份打開cmd窗口,執行./keytool -import -alias 別名 -keystore cacerts -file 證書地址 命令添加證書,提示「證書已添加到密鑰庫中」便可。maven

第五步:重啓IDEAide

此次的坑給個人教訓

日誌看仔細。若是一次沒有成功,切不能否定本身的觀點,多試幾回。能夠把其餘的嫌疑對象,都添加進來。gradle

相關文章
相關標籤/搜索