Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
2013-12-18 11:17
489 查看
Tomcat 6版本配置SSL过程有两步:
1、用JDK自带的keytool.exe来生成私有密钥和自签发的证书,如下:
按提示输入相关内容后,这条命令将在默认密钥库文件里新增一个别名为tomcat的私有密钥项及其自签发的证书。默认密钥库文件为:
2、修改Tomcat的conf\server.xml文件,即增加下面一段:
这里的${user.home}就是上面的%USERPROFILE%,只是一个是Java语法,另一个是Windows语法。
设置好就能正常启动Tomcat了。
可是按同样的方法来配置Tomcat 7却启动不起来,报如下错误:
仔细看上面的异常信息发现这是APR报的错误。Tomcat 6也有APR包但我从来都没用过。为此查看了Tomcat的ssl-how,在“Edit
the Tomcat Configuration File”一节中说到:
Tomcat提供了两个SSL实现,一个是JSSE实现,另一个是APR实现。
Tomcat将自动选择使用哪个实现,即如果安装了APR则自动选择APR,否则选择JSSE。
如果不希望让Tomcat自动选择,而是我们自己指定一个实现则可通过protocol定义,如下:
我又查看了6.0的相同说明,里面与7.0的说明一模一样。因此问题只可能是:是否安装了APR包。
以前只听说过APR但没弄过。APR是什么文件?后来才发现APR文件名为tcnative-1.dll。进一步检查6.0和7.0的安装目录,结果发现6.0里没这个dll文件,而7.0里有。换句话说,6.0默认使用JSSE实现,而7.0默认使用APR实现。
弄明白缘由就好办了。由于习惯使用6.0的配置方式(即JSEE实现),因此只要把上面conf\server.xml里的protocol修改一下就行了:
重新启动,一切正常。
1、用JDK自带的keytool.exe来生成私有密钥和自签发的证书,如下:
keytool -genkey -keyalg RSA -alias tomcat
按提示输入相关内容后,这条命令将在默认密钥库文件里新增一个别名为tomcat的私有密钥项及其自签发的证书。默认密钥库文件为:
%USERPROFILE%\.keystore
2、修改Tomcat的conf\server.xml文件,即增加下面一段:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="${user.home}/.keystore" keystorePass="changeit" />
这里的${user.home}就是上面的%USERPROFILE%,只是一个是Java语法,另一个是Windows语法。
设置好就能正常启动Tomcat了。
可是按同样的方法来配置Tomcat 7却启动不起来,报如下错误:
严重: Failed to initialize end point associated with ProtocolHandler ["http-apr-8443"] java.lang.Exception: Connector attribute SSLCertificateFile must be defined when using SSL with APR
仔细看上面的异常信息发现这是APR报的错误。Tomcat 6也有APR包但我从来都没用过。为此查看了Tomcat的ssl-how,在“Edit
the Tomcat Configuration File”一节中说到:
Tomcat提供了两个SSL实现,一个是JSSE实现,另一个是APR实现。
Tomcat将自动选择使用哪个实现,即如果安装了APR则自动选择APR,否则选择JSSE。
如果不希望让Tomcat自动选择,而是我们自己指定一个实现则可通过protocol定义,如下:
<Connector protocol="..." />
我又查看了6.0的相同说明,里面与7.0的说明一模一样。因此问题只可能是:是否安装了APR包。
以前只听说过APR但没弄过。APR是什么文件?后来才发现APR文件名为tcnative-1.dll。进一步检查6.0和7.0的安装目录,结果发现6.0里没这个dll文件,而7.0里有。换句话说,6.0默认使用JSSE实现,而7.0默认使用APR实现。
弄明白缘由就好办了。由于习惯使用6.0的配置方式(即JSEE实现),因此只要把上面conf\server.xml里的protocol修改一下就行了:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="${user.home}/.keystore" keystorePass="changeit" />
重新启动,一切正常。
相关文章推荐
- Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
- Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
- Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决 作者:孤风一
- Tomcat配置Https报错-Connector attribute SSLCertificateFile must be defined when using SSL with APR
- Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
- Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法
- tomcat配置8443后,启动报错(Connector attribute SSLCertificateFile must be defined when using SSL with APR)
- Connector attribute SSLCertificateFile must be defined when using SSL with A
- Tomcat报错“connector attribute SSLCertificateFile must be defined...”
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used wi
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used wi
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- tomcatSSL配置异常-“No Certificate file specified or invalid file format”
- “The public type XYZ must be defined in its own file”解决方法
- 解决ImageLoader must be init with configuration before using
- Attribute value request.getAttribute("keyWord") is quoted with " which must be escaped when used wit