Why am I not able to start a Java application with SSL?
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?
The droplet I’ve set up is based on Ubuntu 18.04. I used Letsencrypt to get a certificate and this 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:
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:
Caused by: java.io.FileNotFoundException: /root/software/gimmememe/target/keystore.p12 (No such file or directory)
Weirdly enough when I run the same jar with the same keystore.p12 file on my own Windows machine it runs fine:
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)
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:
-rw-r–r– 1 root root 4274 Mar 26 18:44 keystore.p12
I am running my jar file with the following command (tried with sudo infront as well):
java -jar gimme-meme-1.0.0.war
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.