Spring找不到密钥库文件

时间:2017-04-03 14:40:02

标签: java spring spring-boot restlet-2.0

我有这个文件结构;

enter image description here

然后在我的bean xml配置中我有;

enter image description here

但是当我启动服务器时,我得到一个FileNotFoundException /store/thestore.jks

我错过了什么?提前谢谢。

1 个答案:

答案 0 :(得分:2)

根据此处的源代码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);

它正在使用FileInputStream,这意味着它将尝试从文件系统而不是从JAR本身读取文件。

您必须将jks文件放在JAR之外并提供绝对路径。

例如

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