我正在尝试将SSL证书安装到Glassfish 4.1.1中。

我已经完成以下工作:

keytool -importkeystore -srckeystore /home/user/domain.com.jks -destkeystore /opt/glassfish4/glassfish/domains/domain1/config/keystore.jks

keytool -import -trustcacerts -keystore keystore.jks -alias root -file root.crt
keytool -import -trustcacerts -keystore keystore.jks -alias intermediate1 -file 1_cross_Intermediate.crt
keytool -import -trustcacerts -keystore keystore.jks -alias intermediate2 -file 2_issuer_Intermediate.crt
keytool -import -trustcacerts -keystore keystore.jks -alias domain_com -file 3_user_domain.com.crt


然后,使用管理控制台在服务器配置中将http-listener-2的SSL引用从“ s1as”重命名为“ domain_com”。

并通过管理控制台和“重新启动”按钮重新启动了域。

之后,我无法通过https://domain.com:8181访问我的应用程序。错误:


  ERR_CONNECTION_RESET


甚至无法使用https://domain.com:4848访问管理控制台


  ERR_CONNECTION_CLOSED


我在哪里可以看到发生了什么以及如何正确配置SSL。

再说一遍:keystore的密码和glassfish的master-password都是默认密码(changeit),并且彼此匹配。我已经核实了

您能提供一些有关哪里看的线索吗?

先感谢您!

更新:在glassfish日志中,我有以下例外:

[2016-08-17T10:29:53.142+0000] [glassfish 4.1] [WARNING] [] [javax.enterprise.network.config] [tid: _ThreadID=43 _T$
  GRIZZLY0050: SSL support could not be configured!
java.io.IOException: A MultiException has 2 exceptions.  They are:
1. java.lang.Error: java.security.UnrecoverableKeyException: Cannot recover key
2. java.lang.IllegalStateException: Unable to perform operation: post construct on com.sun.enterprise.security.ssl.$

        at org.glassfish.grizzly.config.ssl.JSSE14SocketFactory.init(JSSE14SocketFactory.java:162)
        at org.glassfish.grizzly.config.SSLConfigurator.initializeSSLContext(SSLConfigurator.java:249)
        at org.glassfish.grizzly.config.SSLConfigurator.configureSSL(SSLConfigurator.java:131)
        at org.glassfish.grizzly.config.SSLConfigurator$InternalSSLContextConfigurator.createSSLContext(SSLConfigur$
        at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:209)
        at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:186)
        at org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead(SSLBaseFilter.java:293)

[2016-08-17T10:29:53.143+0000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.filterchain.DefaultFilterChain] $
  GRIZZLY0013: Exception during FilterChain execution
java.lang.NullPointerException
        at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:214)
        at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:186)
        at org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead(SSLBaseFilter.java:293)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)

最佳答案

您忘记在cacerts.jks中插入证书
在这样的cacert中包括根证书和中间证书
keytool-导入-trustcacerts -keystore cacerts.jks-别名root-文件root.crt
密钥工具-导入-trustcacerts-密钥库cacerts.jks-别名中间1-文件1_cross_Intermediate.crt
keytool-导入-trustcacerts -keystore cacerts.jks-别名中间2-文件2_issuer_Intermediate.crt

不需要在cacerts.jks中插入域证书

关于java - 无法使用Glassfish设置SSL,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38993980/

10-13 06:52