Skip to content

Instantly share code, notes, and snippets.

@achintya-kumar
Last active January 22, 2022 18:27
Show Gist options
  • Save achintya-kumar/ae7833b438ea6fb8ae734f9813821151 to your computer and use it in GitHub Desktop.
Save achintya-kumar/ae7833b438ea6fb8ae734f9813821151 to your computer and use it in GitHub Desktop.
Fixing ValidatorException for Nexus servers using self-signed certificate #ValidatorException #Nexus #ssl #cert #keytool #cacerts #java #SunCertPathBuilderException

To fix sun.security.validator.ValidatorException: PKIX path building failed…

OR PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Download the SSL certificate of the server:

echo -n | openssl s_client -connect nexus-devportal.de.dmz.tuhuk.de:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/kumar-pem.cert

Add it to the Java truststore:

sudo keytool -importcert -file /tmp/kumar-pem.cert -alias dmz-huk -storepass changeit -keystore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment