Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify local file path to my ssl keystore file in spring application.properties?

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?

like image 515
SebS Avatar asked Aug 11 '16 07:08

SebS


2 Answers

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

like image 184
luboskrnac Avatar answered Nov 15 '22 07:11

luboskrnac


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>
like image 37
Yuva Avatar answered Nov 15 '22 09:11

Yuva