【发布时间】:2014-02-04 04:19:17
【问题描述】:
我已经设法将我的嵌入式 tomcat 配置为使用密钥库文件,并且当我从 eclipse 执行项目时它可以工作。
代码很简单:
...
String keystore = new File(MyServer.class.getResource("/keystore").toURI()).toPath().toString();
httpsConnector.setAttribute("keystoreFile",keystore);
...
文件keystore 位于添加到构建路径的源目录中。
将项目导出到可执行jar后,我可以验证jar根目录中keyfile的存在。
但是在执行 jar 时,我得到了这个错误:
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
所以我假设我无法使用httpsConnector.setAttribute("keystoreFile",...) 配置密钥文件。还有另一种配置方法吗?我真的不想在临时目录中复制密钥文件并从那里引用它。
【问题讨论】:
标签: java eclipse executable-jar keystore embedded-tomcat-7