Monday, April 8, 2024

Fix - javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification

Download the certificate from the web browser and install it using keytools.

Click on "Connection is secure"


Click on certificate is valid.

Click on export and save it to your hard disk




Open CMD and type below command.

keytool -import -alias ANY_NAME_YOU_WANT_TO_GIVE -file PATH_TO_YOUR_CERTIFICATE -keystore PATH_OF_JAVA_KEYSTORE


PATH_OF_JAVA_KEYSTORE - file will be available at C:\Program Files\Amazon Corretto\jdk11.0.20_9\lib\security


If the keytools are not recognize as a valid command, add java/bin folder to your system environment variable paths.