Resolving PKIX Path Creation Failures | MuleSoft Guide

How can the PKIX path creation fail? How can the issue of not finding a valid certification path to the required target be resolved?

We occasionally run across the following errors when creating applications, which are caused by errors that Maven throws when constructing the application:

[ERROR] Plugin com.mulesoft.munit.tools:munit-maven-plugin:2.2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.mulesoft.munit.tools:munit-maven-plugin:jar:2.2.4: Could not transfer artifact com.mulesoft.munit.tools:munit-maven-plugin:pom:2.2.4 from/to mulesoft-releases (https://repository.mulesoft.org/releases/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

Reason

The system firewall is to blame for the error. The application’s ability to connect to external, unprotected systems is restricted by the system firewall. For the firewall to grant access to the external systems, a valid certificate is necessary.

Solution

The answer is really easy to figure out. To finish our procedure, we must install the necessary certificates from the external system. This will allow us to communicate with the external system on our end.

Two tasks will be carried out by us:

  1. Get the Certificate by downloading it.
  2. Put the certificate in place.

Use the procedures listed below to download the certificate:

Copy the specific URL (in this case, https://repository.mulesoft.org/releases/) from the error and paste it into your browser.

Now, there’s a lock icon to the left of the URL. When you click on this symbol, a window will open. Choose the certificate from the list of options.

The certificate will open in a new window after we select it. The next step is to choose the Details tab and then click Copy to File under Details. Click once again, and a new window will open. Choose Next from that window.

Thus, the certificates have finished downloading. The next step is to use the command line. You need to install the certificate in the cacerts file of the JDK. This JDK is installed on our system.

The certificate is installed using the command line:

Instructions for installation:

keytool -importcert -trustcacerts -alias <alias name for the certificate> -file <path were we have save the certificate> -keystore “<path for the cacerts file>” -storepass changeit

The command for me will be:

keytool -importcert -trustcacerts -alias repo -file C:\Users\muletrain\Downloads\repository.mulesoft.org.cer -keystore “C:\Program Files\Java\jdk1.8.0_131\jre\lib\security\cacerts” -storepass changeit

Note:

C:\Program Files\Java\jdk1.8.0_131\jre\lib\security is my java loacation

C:\Users\muletrain\Downloads\repository.mulesoft.org.cer is my certificate location which I saved.

To install the certificate, take the following actions:

Launch the Command Prompt in Administrator mode. And hit Enter after using the common for installation.

The command will request confirmation after it has been carried out. If you select “Yes,” the certificate will be installed after verification.

We successfully downloaded and installed the certificate on our system using the aforementioned procedure.

 Now, when we run the application, it will get the necessary data from that specific system. It will not display any certificate difficulties.

]]>
Post a Comment (0)
Previous Post Next Post