The following error appeared upon upgrading JRuby:
OpenSSL::X509::StoreError: setting default path failed: Invalid keystore format
wget http://curl.haxx.se/ca/cacert.pem
sudo keytool -importcert -file cacert.pem -keystore /Users/youruser/.keystore
export SSL_CERT_FILE=/Users/youruser/.keystore
jruby -S gem install whatever
Thank you for this! I spent a fair amount of time on this problem, and this page was the most helpful. Want to make two additions:
Information about http://curl.haxx.se/ca/cacert.pem is at https://curl.haxx.se/docs/caextract.html
I found my problem to be only that my $JAVA_HOME/lib/security/cacerts file was corrupt in some way. I verified it by running this
command:
Taking the error message at its word, I simply removed and reinstalled the JDK. When the above command listed the keys in the cacerts file, then jruby installed fine without errors. I then was able to remove the ~/.keystore file and SSL_CERT_FILE setting.