title: javax.net.ssl.SSLHandshakeException on a tomcat server
body: <p>I want to get the content of a url with the <strong>https</strong> protocol. The problem is that when this code is executed from a <strong>tomcat server</strong>, I get a <strong>HandshakeException</strong>.</p>
  
  <pre><code>url = new URL("https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Nivo/nivo.20140309.csv");    
  Scanner s = new Scanner(url.openStream());
  </code></pre>
  
  <p>I tried to look into other stackoverflow questions (<a href="https://stackoverflow.com/questions/859111/how-do-i-accept-a-self-signed-certificate-with-a-java-httpsurlconnection">How can I use different certificates on specific connections?</a> or <a href="https://stackoverflow.com/questions/18787419/ssl-socket-connection">SSL Socket connection</a>) and it seems I need to define a <code>KeyStore</code>. </p>
  
  <p>I have no idea of how to do this.</p>
  
  <p>The full error in the tomcat server is</p>
  
  <pre><code>javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
  </code></pre>
  
  <p>What is the best way to acheve this?</p>