3

我正在 Eclpse 上使用 Tomcat6 + SSL 设置测试环境

我编辑了server.xml文件(在 Eclipse 服务器文件夹中)并取消了 SSL 连接器的注释。然后我按照这个操作指南制作了一个自签名证书。一切正常,直到我将密钥库文件保存在我的主目录中,但是,当我尝试将它放在另一个文件夹中并设置“keystoreFile”参数时,我在启动时收到此错误消息:

GRAVE: Failed to load keystore type JKS with path C:\Documents and Settings\myUser/.keystore due to C:\Documents and Settings\myUser\.keystore (Impossibile trovare il file specificato) 
java.io.FileNotFoundException: C:\Documents and Settings\myUser\.keystore (Impossibile trovare il file specificato)

似乎 Tomcat 没有读取我的 keystoreFile 参数。

这是我的server.xml文件(仅限 SSL 相关部分)

               ...
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
               ...
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="C:\myPath\.keystore"
           keystorePass="******"  />
               ...

更新

我将项目导出为.war文件并将其部署在独立的Tomcat 上。它可以工作,所以它一定是 Eclipse 导致我的问题的原因。如果它可以帮助我使用 Eclipse Helios (Service Release 2)。

谢谢。

结语

最后,感谢 Bruno,它发现是 Eclipse 搞砸了部署文件。清理 eclipse 部署文件夹后,一切正常。

4

1 回答 1

3

keystoreFile没有效果,因为您使用的是APR 连接器( AprLifecycleListener),它使用的参数集与JSSE 连接器不同。

特别是,它不使用keystoreFileOpenSSL 样式的参数(类似于 Apache Httpd 的mod_ssl配置):您需要转换您的密钥和证书才能使其与 APR 连接器一起使用。

于 2012-09-10T10:16:06.457 回答