When using self-signed certificates you might come across the following error: > "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"

To solve this, you need to import the untrusted certifcate in to Java's keystore. Begin by executing the following command:

openssl s_client -showcerts -connect

Create a new file called root.crt and paste everything between:


Save root.crt on your desktop and import into Java keystore with the following command:

sudo keytool -importcert -keystore /etc/java-8-oracle/security/cacerts -storepass changeit -file ~/Desktop/root.crt -alias "rhel-root"