PKIX path building failed: sun.security.provider.certpath.SunCertP athBuilderException: unable to find valid certification path to requested target
Receiving following error while creating build using Maven
PKIX path building failed: sun.security.provider.certpath.SunCertP athBuilderException: unable to find valid certification path to requested target
We tried resolving it with Solution 1 (, as below). But, after lots of tries - we did went with Solution 2, which is not recommended.
Solution 1:
- Open your website in browser, click on Lock icon to export selected certificate of website to a file on your local machine.
- Then execute below command to import Certificate to your keystore -
keytool –import –noprompt –trustcacerts –alias ALIASNAME -file /PATH/TO/YOUR/DESKTOP/CertificateName.cer -keystore /PATH/TO/YOUR/JDK/jre/lib/security/cacerts -storepass changeit
You can also generate your own keystore using following command -
keytool -keystore clientkeystore -genkey -alias client
And, give it maven command as below -
mvn package -Djavax.net.ssl.trustStore=clientkeystore
But, clearly Solution 1 didn't work for us. So, here is Solution 2
Solution 2 -
- Disable Certificate Validation, and allow maven to use insecure connection.
mvn clean compile -U -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
Comments
Post a Comment