javaspringspring-bootrestlet-2.0

Spring cannot find key store file


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.


Solution

  • 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>