找不到spring-boot可执行文件war密钥库 [英] spring-boot executable war keystore not found

查看:158
本文介绍了找不到spring-boot可执行文件war密钥库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ssl支持下构建了spring-boot可执行文件战争. 我的application.properties文件是:

I build spring-boot executable war with ssl support. My application.properties file is:

server.port = 8443
server.ssl.key-store = classpath:keystore.jks
server.ssl.key-store-password = secret
server.ssl.key-password = another-secret

WAR文件包含"keystore.jks"文件.但是我得到一个奇怪的例外:

WAR file contains 'keystore.jks' file. But I get strange exception:

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Could not find key store classpath:keystore.jks

Caused by: java.io.FileNotFoundException: class path resource [keystore.jks] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/D:/projects/vi3na/vi3na.web/target/vi3na.war!/WEB-INF/classes!/keystore.jks

什么标记!"在路径'D:/projects/vi3na/vi3na.web/target/vi3na.war!/WEB-INF/classes!/keystore.jks'中表示

What does sign '!' mean in the path 'D:/projects/vi3na/vi3na.web/target/vi3na.war!/WEB-INF/classes!/keystore.jks'

推荐答案

更新:由于

Update: As a result of this enhancement request, the limitation described below no longer applies. Tomcat 8.0.28+ and 7.0.66+ can load a key store from within a jar file.

我猜您正在使用Tomcat作为嵌入式servlet容器吗?如参考文档中提到的 ,Tomcat当前不支持从jar内加载密钥库或信任库:

I guess that you're using Tomcat as the embedded servlet container? As noted in the reference documentation, Tomcat does not currently support loading a keystore or trust store from within a jar:

Tomcat要求可以在文件系统上直接访问密钥存储(如果使用的话,还需要信任存储),即不能从jar文件中读取它.

Tomcat requires the key store (and trust store if you’re using one) to be directly accessible on the filesystem, i.e. it cannot be read from within a jar file.

您应该将keystore.jks从jar中移出,并用其在文件系统中的位置更新server.ssl.key-store.

You should move keystore.jks out of your jar and update server.ssl.key-store with its location on the file system.

这篇关于找不到spring-boot可执行文件war密钥库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆