title: Spring Java app not finding the keystore file
body: <p>I am trying to set up a simple Spring application to use SSL and host it on Digital Ocean. Why is my app not finding the keystore file?</p>
  
  <p>The droplet I've set up is based on Ubuntu 18.04. I used Letsencrypt to get a certificate and <a href="https://dzone.com/articles/spring-boot-secured-by-lets-encrypt" rel="nofollow noreferrer">this</a> guide to generate a PKCS file. I've set up my application.properties file to look in the jar file's current directory like so:</p>
  
  <pre><code>security.require-ssl:true
  server.ssl.key-store:keystore.p12
  server.ssl.key-store-password:&lt;password&gt;
  server.ssl.key-store-type:PKCS12
  server.ssl.key-alias:&lt;alias&gt;
  
  </code></pre>
  
  <p>I would expect this to run and start a web server on the configured port. However, what I get in the stack trace is this:</p>
  
  <pre><code>Caused by: java.io.FileNotFoundException: /root/software/gimmememe/target/keystore.p12  (No such file or directory)
  </code></pre>
  
  <p>Weirdly enough when I run the same jar with the same keystore.p12 file on my own Windows machine it runs fine:</p>
  
  <pre><code>o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9123 (https) with context path ''
  meme.Application                         : Started Application in 4.985 seconds (JVM running for 5.464)
  </code></pre>
  
  <p>I don't think it's a permissions issue on the Ubuntu machine as I tried setting the permissions on the keystore file like so:</p>
  
  <pre><code>-rw-r--r-- 1 root root     4274 Mar 26 18:44 keystore.p12
  </code></pre>
  
  <p>I am running my jar file with the following command (tried with sudo infront as well):</p>
  
  <pre><code>java -jar gimme-meme-1.0.0.war
  </code></pre>