title: How to load a keystore, which is inside the resource folder (maven)?
body: <p>I have a custom SSL factory, where I load my own truststore.</p>
  
  <p>Now when I put the truststore.jks file into the project root folder, it works with the following line:</p>
  
  <pre><code>ks.load(new FileInputStream("/truststore.jks", passphrase);
  </code></pre>
  
  <p>But I want my truststore inside my resource folder, which was built with maven where the path is <strong>src/main/resources</strong>.</p>
  
  <p>Then I do and it doesn't work with the following line:</p>
  
  <pre><code>ks.load(this.getClass().getResourcesAsStream("/truststore.jks"), passphrase);
  </code></pre>
  
  <p>Though the input stream exists. I checked it. It only fails when I do ks.load(...).</p>
  
  <p>The exception that I get is:</p>
  
  <pre><code> java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
  </code></pre>
  
  <p>Why is that?</p>
  
  <p>Regards, 
  Dave</p>