Spring cannot find key store file

2.9k Views Asked by At

I have this file structure;

enter image description here

Then on my beans xml config I have;

enter image description here

But when I start the server up I get a FileNotFoundException /store/thestore.jks

What am I missing? Thanks in advance.

1

There are 1 best solutions below

1
11thdimension On BEST ANSWER

According to source code here com.noelios.restlet.util.DefaultSslContextFactory.createSslContext()

190            FileInputStream keyStoreInputStream = null;
191            try {
192                keyStoreInputStream = ((this.keyStorePath != null) && (!"NONE"
193                        .equals(this.keyStorePath))) ? new FileInputStream(
194                        this.keyStorePath) : null;
195                keyStore.load(keyStoreInputStream, this.keyStorePassword);

It's using FileInputStream, which means it will try to read file from the file system and not from the JAR itself.

You have to put jks file outside JAR and provide absolute path to it.

For example

<prop key="keyStorePath">C:/store/thestore.jks</prop>