sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This occurs when Java doesn’t trust the SSL certificate of the site/server you're connecting to.
Issue is Fixed after Importing the Certificate into the Java Truststore.
Export the certificate from your browser or download it from a trusted source.
Save it as:C:\Users\Administrator\Downloads\emSign Root CA - G1.crt
Open PowerShell as Administrator and run:
cd 'C:\Program Files\Java\jdk-17.0.3.1\lib\security'Â
Run the following command in the same PowerShell window:
keytool -importcert -file 'C:\Users\Administrator\Downloads\emSign Root CA - G1.crt' -keystore .\cacerts -alias 'cn_emsign_root_ca__g1,o_emudhra_technologies_limited,ou_emsign_pki,c_in [jdk]'Â
When prompted for a password, enter:Â changeit
✅ Confirm the import by typing yes
when prompted.
Restart the Java application — it should now trust the certificate.