Last Updated: February 25, 2016
· alvarogarcia7

Fixing SunCertPathBuilderException caused by Maven downloading from self-signed repository


If you have a Maven repository running under https with a self-signed certificate, then building a Maven project can report the following error:

Error transferring file: PKIX path building failed: unable to find valid certification path to requested target

There was an Oracle blog posted by Andreas Sterbenz back on Oct 09, 2006 that helped me diagnose the problem, but that blog is no longer available. Thankfully Andreas' blog was re-posted here. For additional information, I found another blog post that was helpful.

Anyways, I fixed this problem by downloading and compiling the source for (copy is available as a gist), see append 1. and running the following command:

cd C:\tmp

mkdir certificates
cd certificates

mkdir com\aw\ad\util\
#copy file InstallCert to util


type 1

#wait for jssecacerts to be generated

This generated a file named jssecacerts in the current directory.

On Windows/Linux, this file needs to be copied to the JAVA_HOME/jre/lib/security/ directory.

this was C:\program files\java\JAVA_XXXX\jre....

On Mac needs to be copied to the JAVA_HOME/lib/security/ directory.

After I did this, Maven was able to download the artifacts from the self-signed repository.