Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
来源:互联网 发布:数据圈付费社区 编辑:程序博客网 时间:2024/05/17 08:02
Tomcat 6版本配置SSL过程有两步:
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" />
重新启动,一切正常。
0 0
- 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 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
- Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法
- Connector attribute SSLCertificateFile must be defined when using SSL with A
- 解决tomcat配置ssl报Connector attribute SSLCertificateFile
- Tomcat SSL restart connector
- Using RMI with SSL
- Attribute value request.getParameter("itemID") is quoted with " which must be escaped when used with
- Tomcat使用APR和不使用APR的单向SSL配置
- Tomcat使用APR和不使用APR的单向SSL配置
- Tomcat使用APR和不使用APR的单向SSL配置
- 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 request.getAttribute("keyWord") is quoted with " which must be escaped when used wi
- 手机电池保护教程
- SSH全局异常抛出并输出页面
- Android的搜索框SearchView的用法-android学习之旅(三十九)
- 动态规划:从新手到专家
- 黑马程序员_正则表达式
- Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
- 黑马程序员_Java基础泛型
- HDU ACM 1077 Catching Fish
- 表达式求值
- 黑马程序员_Java_异常机制及常见异常总结
- HDU 3535 AreYouBusy
- Install the high performance Nginx web server on Ubuntu
- unity内部float类型转换string类型只保留整数部分
- 数学中国体力值