欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Tomcat ssl报错Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法

程序员文章站 2022-07-09 17:33:12
今天同事要求帮忙配置tomcat ssl,直接把linux下tomcat配置ssl这篇文章发给他了,没想到他居然说启动tomcat的时候,报connector attrib...

今天同事要求帮忙配置tomcat ssl,直接把linux下tomcat配置ssl这篇文章发给他了,没想到他居然说启动tomcat的时候,报connector attribute sslcertificatefile must be defined when using ssl with apr的错误,马上跑过去看,原来他的tomcat版本是7.0的,我发给他的是tomcat6的,检查了key,检查了配置文件,因为他直接复制的我发他文章的配置,折腾了2-3个小时,终于把问题给解决了.

系统:windows 7
环境:tomcat7

1.先重新给他生成key

复制代码 代码如下:

keytool -genkey -alias tomcat -keyalg rsa

enter keystore password:  password
re-enter new password: password
what is your first and last name?
  [unknown]:  loiane groner
what is the name of your organizational unit?
  [unknown]:  home
what is the name of your organization?
  [unknown]:  home
what is the name of your city or locality?
  [unknown]:  sao paulo
what is the name of your state or province?
  [unknown]:  sp
what is the two-letter country code for this unit?
  [unknown]:  br
is cn=loiane groner, ou=home, o=home, l=sao paulo, st=sp, c=br correct?
  [no]:  y
 
enter key password for
    (return if same as keystore password):  password
re-enter new password: password


2.tomcat配置ssl

打开server.xml文件里,他们原来是

复制代码 代码如下:

<connector port="8443" protocol="http/1.1" sslenabled="true" enablelookups="false"
           acceptcount="100" disableuploadtimeout="true"
           maxthreads="150" scheme="https" secure="true"
           clientauth="false" sslprotocol="tls"
           keystorefile="users\loiane/.keystore"
           keystorepass="password" />

修改为:

复制代码 代码如下:

<connector port="8443" protocol="org.apache.coyote.http11.http11protocol" sslenabled="true"
           enablelookups="false"
           acceptcount="100" disableuploadtimeout="true"
           maxthreads="150" scheme="https" secure="true"
           clientauth="false" sslprotocol="tls"
           keystorefile="users\loiane/.keystore"
           keystorepass="password" />