MuleSoft Technical Guides

Troubleshooting PKIX path building failure in Anypoint Studio

User MuleSoft Integration Team
Calendar May 23, 2023

In this blog post, we will see how to resolve the PKIX path building failed error when we install the Anypoint Studio and try to run a project for the first time. This is a common issue that happens when JVM cannot find the Anypoint Platform certificates in its trust store.

Issue: SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------< com.mycompany:helloworld >----------------------
[INFO] Building HelloWorld 1.0.0-SNAPSHOT
[INFO] --------------------------[ mule-application ]--------------------------

[INFO] 
[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean-1) @ helloworld ---
Downloading from: https://repository.mulesoft.org/releases/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Downloading from: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.334 s
[INFO] Finished at: 2023-05-02T07:32:01Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean (default-clean-1) on project helloworld: Execution default-clean-1 of goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:3.2.0 or one of its dependencies could not be resolved: Could not transfer artifact org.codehaus.plexus:plexus-utils:jar:1.1 from/to mulesoft-releases (https://repository.mulesoft.org/releases/): transfer failed for https://repository.mulesoft.org/releases/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Solution: Import the Mulesoft Certificates to JVM

Step 1: Find which Java is used by Anypoint Studio

  • Go to Anypoint Studio ???? Window ???? Preferences ???? Java ???? Installed JREs
  • Copy the location of the Java: C:\AnypointStudio\plugins\org.mule.tooling.jdk.win32.x86_64_1.1.5

  • Make sure AnypointStudio.ini file also refer to the same

Step 2: Download MuleSoft Certificates

  • Go to https://anypoint.mulesoft.com/login/
  • Click on the Lock pad Icon ????Connection is secure ???? Certificate is valid ???? Details
  • Select Root Tag in Certificate Hierarchy and click on Export and download the file as “Der-encoded binary, Single Certificate”
  • Do the same for child tags as well. (Download all 3 certificates.Der file type)
  • In this case
    • Root Tag: Cato Networks CA
    • Child Tag: Cato Networks Server chicatod1
    • Child Tag: anypoint.mulesoft.com

  • Open a command prompt and navigate to the java folder which we have copied in Step1 C:\AnypointStudio\plugins\org.mule.tooling.jdk.win32.x86_64_1.1.5 \jre\lib\security
  • Cmd keytool -importcert -file “Certificate File Path” -keystore cacerts -alias “Alias Name” -storepass changeit
  • Execute the below commands individually and type “changeit” for the password and “yes” for the Trust This certificate.
    • keytool -importcert -file C:/Users/ksumar/Downloads/anypoint.mulesoft.der -keystore cacerts -alias “anypoint.mulesoft cert”
    • keytool -importcert -file C:/Users/ksumar/Downloads/CatoNetworkserverchicatod1.der -keystore cacerts -alias “CatoNetworkserverchicatod1 cert”
    • keytool -importcert -file C:/Users/ksumar/Downloads/CatoNetworkCA.der -keystore cacerts -alias “CatoNetworkCA cert”

  • Once all the certificates are successfully added to JVM restart the studio and run the API again.

Find more MuleSoft Technical Guides at Caelius Consulting Resource Centre.

Leave a comment

Your email address will not be published. Required fields are marked *