title: Spring boot embedded tomcat not loading SSL keystore file from classpath
body: <p>I am using Spring boot 1.2.7 for my application and as a requirement I have to load the SSL cert from classpath. So, I added my PKCS12 file in my classpath and used following code (in <code>AppInitializer</code> class to load it:</p>
  
  <pre><code>final String sslKeystoreFilepath = this.getClass().getClassLoader().getResource(sslKeystoreFilename).getFile();
  </code></pre>
  
  <p>I am noticing two things here:</p>
  
  <ol>
  <li><p>The string contains <code>file:</code> in it. If I run the same code through a plain standalone program with <code>main</code> method, I couldn't see anything like <code>file:</code>.</p></li>
  <li><p>When I run the Spring boot app (using generated fat jar), it throws exception saying:</p></li>
  </ol>
  
  <p><code>SEVERE: Failed to load keystore type PKCS12 with path /Users/my_user/Projects/my_app/build/libs/myapp-1.0-SNAPSHOT-dev.jar!/dev_keystore.p12 due to /Users/my_user/Projects/my_app/build/libs/myapp-1.0-SNAPSHOT-dev.jar!/dev_keystore.p12 (No such file or directory)
  java.io.FileNotFoundException: /Users/my_user/Projects/my_app/build/libs/myapp-1.0-SNAPSHOT-dev.jar!/dev_keystore.p12 (No such file or directory)</code></p>
  
  <p>What am I doing wrong?</p>