Feng erdong's Blog

Life is beautiful

Fix the "Failure Initializing Default System SSL Context" Issue

| Comments

Encountered this problem when I try to resolve dependencies for a gradle project, the root cause is a ssl certificate file can not be found in JDK installation.

Find below solution on internet:

1
2
3
4
5
6
7
8
9
#!/bin/sh
set -e
#the location of certificate file which gradle asks for, create the directory if it's not existed.
cacerts=/Library/Java/JavaVirtualMachines/1.6.0_38-b04-436.jdk/Contents/Home/lib/security/cacerts

curl 'https://docs.codehaus.org/download/attachments/158859410/startssl-CA.pem?version=1&modificationDate=1277952972158' \
      | keytool -import -alias StartSSL-CA -file /dev/stdin -keystore $cacerts -storepass changeit -noprompt
curl 'https://docs.codehaus.org/download/attachments/158859410/startssl-Intermediate.pem?version=1&modificationDate=1277952972182' \
      | keytool -import -alias StartSSL-Intermediate -file /dev/stdin -keystore $cacerts -storepass changeit -noprompt

create a new file and paste the code into it, then run with sudoer permission.

Comments