我有 Tomcat 9.0.12 和 Java JDK/JRE 1.8.0_191。我正在尝试配置 SSL/TLS。我已经像这样更改了我的 server.xml 文件:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\my_certificate.pfx"
keystorePass="my_password" keystoreType="PKCS12" />
我的证书文件是 *.pfx 格式。我通过命令行使用 startup.bat 命令运行 tomcat 服务器。但是我收到了这样的错误(在我的 catalina.log 中):
...
05-Nov-2018 16:33:57.080 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
05-Nov-2018 16:33:57.190 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Nov-2018 16:33:57.205 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[org.apache.coyote.http11.Http11Protocol-443]]
org.apache.catalina.LifecycleException: Protocol handler instantiation failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:904)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:852)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:656)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:306)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491)
...
当我尝试连接http://localhost:443时,我得到了 ERR_CONNECTION_REFUSED,我在下面添加了它。
ERR_CONNECTION_REFUSED: