Monday, 26 March 2018

Solution for

How to resolve the PKIX path building failed

When you first setup Maven in your office/home computer you might come up with an exception as below when you try to run/build the Maven project.

Could not transfer artifact com.adobe.aem:aem-api:pom: from/to adobe-public-releases ( PKIX path building failed: unable to find valid certification path to requested target -> [Help 1]

SOLUTION to PKIX path building failed

So for the exception above we can see that the URL is clearly mentioned in the exception report. In this case it is

Resolution Steps:

STEP 1:  Navigate to the URL in the exception report using a browser. In this case I am using Google Chrome browser. See below snapshot.

STEP 2: Now press F12 or right click on the page and click on “Inspect”. This will open the developer tools.

STEP 3: Go to the “Security” tab.

STEP 4: Click on the “View Certificate” button.

STEP 5: Check the name of the Certificate (or the issuing authority)

STEP 6: Now close this window and go to browser “Settings”.

STEP 7: Now search for “Manage Certificates”. Alternatively, you can open the “Internet Options” in IE or similar browser and go to “Content” tab and click on “Certificates” button.

STEP 8: Now find the name of the certificate matching the one in STEP 5.

STEP 9: Click on “Export” and export it in a new file (using the default selected format).

STEP 10: Now run the JAVA  Keytool command to add this certificate to your computer’s JDK keystore.

STEP 11: You should run this command.

keytool -import -alias ctsrootca3 -file D:\certs\ctsrootca3.cer -keystore "C:\Program Files\Java\jdk1.8.0_152\jre\lib\security\cacerts"

Please make changes as below.
D:\certs\ctsrootca3.cer  - This should be the path to your certificate file that you exported.
C:\Program Files\Java\jdk1.8.0_152 – This should be path to your JDK folder.
If prompted for a password use : “changeit” (without the quotes, this is the default password for cacerts file)

STEP 12: After successful addition of the key you will see a message like this.

STEP 13: If you have followed this steps correctly then now when you run Maven it should not give any errors.

No comments:

Post a Comment

Coder Magnet
CoderMagnet is full of resources from our daily development activities. It has solutions for common problematic scenarios in technologies like Java 8, AEM, JCR and also occasionally gives you tips on Blogger as well.