spring-boot: Can't find the location of file keystore when running as jar

I use Spring Boot 1.4.0. And I find that tomcat can’t read the keystore conatined in a jar. But how can I load the keystore in a jar.

The configuration about SSL:

server:
  port: 8443
  ssl:
    enabled: true
    key-store: classpath:keystore.jks
    key-store-password: pass
    key-alias: pass
    #protocol: TSL
    enabled-protocols: TLSv1,TLSv1.1,TLSv1.2

The Exception:

java.io.FileNotFoundException: class path resource [xx.jks] cannot be resolved to absolute file path because it does not reside in the file system:jar:file:/C:/xx/xx/xx/xx/xx/target/xx-1.0-SNAPSHOT.jar!/xx.jks

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Thanks. I fixed it by your samples.