Skip to content

Instantly share code, notes, and snippets.

@dtelaroli
Created July 28, 2022 15:04
Show Gist options
  • Save dtelaroli/3f7b80800934896e0036023f94fd5156 to your computer and use it in GitHub Desktop.
Save dtelaroli/3f7b80800934896e0036023f94fd5156 to your computer and use it in GitHub Desktop.
How to fix SunCertPathBuilderException: unable to find valid certification path to requested target in MacOS
# step 1
# execute the command to get the certificates
openssl s_client -showcerts -connect start.spring.io:443
# copy the lines stating in: Certificate chain (including this line)
# Ending in last -----END CERTIFICATE-----
# step 2
# create the cert file with this content
mkdir $HOME/certs
touch $HOME/certs/root.crt
vim $HOME/certs/root.crt
# paste the cert content
# step 3
# import the cert
$JAVA_HOME/bin/keytool -importcert -alias your-alias -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -file $HOME/certs/root.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment