3
0

More than 1 year has passed since last update.

【Java】「sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target」の対処法

Posted at

まえがき

このエラーに3時間ほど時間とられたので備忘として残しておく。

事象

mvn clean実行時に以下のエラーログが出力される。

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 

リモートリポジトリにある依存をダウンロードするときに、有効なSSL証明書がないと怒られる。

対処方法

SSL証明書は$JAVA_HOME/lib/security/cacertsに作成済だったのだが、こいつを読み取ってくれていなかったのが原因だった。読み取ってくれるように、-Djavax.net.ssl.trustStoreオプションでキーストアを指定する。

mvn clean -Djavax.net.ssl.trustStore=C:\dev\tools\openjdk11\lib\security\cacerts

.mavenrcに以下のように記載してもよい。

MAVEN_OPTS="-Djavax.net.ssl.trustStore=C:\dev\tools\openjdk11\lib\security\cacerts"

参考

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0