title: Importing SSL certificates in Glassfish Application Server
body: <p>I am trying to enable SSL on a project on Netbeans IDE and using Glassfish application Server.</p>
  
  <p>For the SSL; i followed the procedure below.</p>
  
  <ol>
  <li>Generated a keystore > <code>keytool -genkey -alias client_keystore -keyalg RSA -keystore client_keystore.jks -keysize 2048</code></li>
  <li>Generated a CSR > <code>keytool -certreq -alias client_keystore -file yourcsrname.csr -keystore client_keystore.jks</code></li>
  <li>Submitted the CSR to another party.</li>
  <li>Received three .pem certificates from the party. I converted the .pem to .crt as <code>openssl x509 -outform der -in your-cert.pem -out your-cert.crt</code></li>
  <li>Importing the certs to my keystore as below;</li>
  </ol>
  
  <p><code>keytool -import -trustcacerts -alias intermediate  -file GoDaddy_Intermediate.crt -keystore client_keystore.jks</code></p>
  
  <p><code>keytool -import -trustcacerts -alias root -file GoDaddy_Root.crt -keystore client_keystore.jks</code></p>
  
  <p><code>keytool -import -trustcacerts -alias BizSwitch -file BizSwitch.crt -keystore client_keystore.jks</code></p>
  
  <ol start="6">
  <li>Import the keystore to the default glassfish keystore ><code>keytool -importkeystore -srckeystore ~/Downloads/ipay/client_keystore.jks -destkeystore keystore.jks</code></li>
  <li>Restarted glassfish server.</li>
  </ol>
  
  <p>I am not sure if that's all but I am getting the <code>sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</code> exception.</p>
  
  <p>On restarting, from the glassfish logs I do not see the certificates being loaded as well.</p>
  
  <p>Am I missing something? </p>