How do I specify local file path to my ssl keystore file in spring application.properties?
Solution 1
Check which version of tomcat is being used by spring boot. According to this github issue tomcat versions less than 7.0.66 relativize the server.ssl.key-store setting.
Solution 2
Do not rely on absolute paths. Put the file into same directory as Spring Boot JAR and add this line into your application.properties:
server.ssl.key-store=file:keystore.jks
Second option is to pass system variable to -Dserver.ssl.key-store=file:keystore.jks
Solution 3
Below worked for me with Tomcat 8.5.2:
Windows:
server:
ssl:
key-store: file:C:\<complete file path with extension>
Linux:
server:
ssl:
key-store: file:/J2EE/<complete file path with extension>
Related videos on Youtube
SebS
Updated on July 09, 2022Comments
-
SebS almost 2 years
Given I have file in
c:\path\to\file\keystore.jks
and my application.properties file contains
server.ssl.key-store=c:\path\to\file\keystore.jks
I get the following exception
java.io.FileNotFoundException: C:\Windows\Temp\tomcat.2910824355292831382\file:\c:\path\to\file\keystore.jks (The filename, directory name, or volume label syntax is incorrect)
What is the correct way to specify the path?
-
Boris the Spider almost 8 yearsIt's a URI! You need to use
file://
.
-
-
SebS almost 8 yearsI have tried quotes this did not make a difference.
-
SebS almost 8 yearsIt always prepends the c\windows\temp\tomcat...... before. I think this is the server.tomcat.basedir path.
-
SebS about 6 yearsTomcat version 8.5 cannot be used with Java6.