If you use a self-signed SSL certificate or a certificate that has been issued by unknown CA (certificate authority), Java client will raise an exception:
SunCertPathBuilderException: unable to find valid certification path to requested target
To resolve this issue the self-signed certificate or the CA certificate should be imported into Java keystore using a keytool command.
In this note i will show how to import a certificate into Java keystore using the keytool command in a non-interactive way.
I will also show an example of how to import a CA certificate into Java keystore cacerts. (more…)