How to apply SSL certificate on JAVA cacerts keystore file

How to apply SSL certificate on JAVA cacerts keystore file


Error in logs:

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target



Solution:

      - Get the SSL certificate from your IT team
      - To import this certificate on JAVA, please follow the below steps
      - Open the CMD and go to you JDK/bin path, like C:\Program Files\Java\jdk1.8.0_91\bin
      - Type the below command, you need to replace the highlighted part in the below command with your values.

            keytool -importcert -file "D:\SSL-Certificate\filename.cer" -alias randomaliasname -keystore  JAVA_HOME/jre/lib/security/cacerts -storepass changeit


      - Now apply the same certificate on JRE folder as well


            keytool -importcert -file "D:\SSL-Certificate\filename.cer" -alias randomaliasname -keystore  JRE_HOME/lib/security/cacerts -storepass changeit


      Links to better reach 

            Bot Store

             EPD