我正在将我的应用从HTTP移动到HTTPS,并且似乎遇到了问题。
以下是我基于these instructions:
所做的工作在我的server.xml中,我有以下内容:
<!-- SSL/TLS Connector configuration using the admin devl guide keystore-->
<Connector protocol="HTTP/1.1" SSLEnabled="true"
port="8443" address="${jboss.bind.address}"
scheme="https" secure="true" clientAuth="false"
keystoreFile="C:/dev/server/jboss-5.1.0.GA/server/ecotrak/conf/server.keystore"
keystorePass="password" sslProtocol = "TLS" keyAlias="jbosskey" />
当我启动服务器时,我有以下内容:
call %JBOSS_HOME%\bin\run.bat -c default -b 0.0.0.0 -Djavax.net.ssl.trustStore=C:/dev/server/jboss-5.1.0.GA/server/ecotrak/conf/server.keystore
以下是我在日志文件中的内容:
00:09:03,110 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\dev\jdk\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\dev\jdk\jre\bin;native
00:09:03,197 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080
00:09:03,214 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
00:09:03,261 ERROR [Http11Protocol] Error initializing endpoint
java.io.IOException: Cannot recover key
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:456)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:139)
日志的另一部分
00:09:03,265 ERROR [AbstractKernelController] Error installing to Start: name=WebServer state=Create
LifecycleException: Protocol handler initialization failed: java.io.IOException: Cannot recover key
at org.apache.catalina.connector.Connector.initialize(Connector.java:1031)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:683)
错误部署:
Deployment "WebServer" is in error due to the following reason(s): LifecycleException: Protocol handler initialization failed: java.io.IOException: Cannot recover key
Deployment "jboss.web:service=WebServer" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.web:service=WebServer' **
关于这里发生了什么的任何理想?
更新
我发现了我的错误 - 我混淆了密钥库和证书之间的密码。一旦修复了,我现在可以在HTTPS下运行该网站
答案 0 :(得分:3)
我按照上面的说明操作,并报告了相同的错误。 我不明白你的更新,所以我写了一个包含以下内容的批处理文件:
c:
cd "/opt/fg/jboss-5.1.0.GA/server/default/conf"
REM create the server.keystore file - will fail if it already exists
keytool -genkey -alias jbosskey -keypass changeit -keyalg RSA -keystore server.keystore -storepass changeit -dname "CN=localhost, OU=MY_DEPARTMENT, O=MY_COMPANY, L=MY_CITY, S=MY_STATE, C=US"
REM display what was made
keytool -list -keystore server.keystore -storepass changeit
REM generate and store the certificate
keytool -export -alias jbosskey -keypass changeit -file server.crt -keystore server.keystore -storepass changeit
keytool -import -alias jbosscert -keypass changeit -file server.crt -keystore server.keystore -storepass changeit
REM display what was made
keytool -list -keystore server.keystore -storepass changeit
这样做有助于我了解所有密码的设置位置。最初我没有阅读它们就复制并粘贴了命令。我没注意到一些命令中嵌入了密码。突然之间你的更新帖子对我来说更有意义。
对于任何有同样麻烦的人,无论何时,你都会在我写的bat文件中看到“changeit”,将其更改为你的密码。
您还需要在上面的脚本中更改计算机名称,部门,组织,州和国家/地区。
现在JBoss似乎正在为我启动。
感谢您的帖子和更新。
答案 1 :(得分:2)
在我的情况下,密钥库密码和别名密码是不同的。他们必须是相同的(至少在Tomcat中)。
答案 2 :(得分:1)
该错误的另一个原因是密钥库使用高级加密。如果为true,则需要安装Java Cryptography Extension以增加java加密级别支持(由于美国导出规则,默认情况下不启用)
请检查JCE install mini-howto如何执行此操作。