如何在Tomcat中启用HTTP / 2?

时间:2019-05-28 10:45:26

标签: java tomcat http2 tomcat9

如何在apache-tomcat-9。*中启用HTTP / 2。 Tomcat的最新版本提供对HTTP / 2的全面支持。我将以下配置放在server.xml文件中。但是,服务器抛出一个错误。

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150" SSLEnabled="true">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>
    <SSLHostConfig honorCipherOrder="false">
        <Certificate certificateKeyFile="/home/user/cert/server.key"  certificateFile="/home/user/cert/server.crt"/>
    </SSLHostConfig>
</Connector>

错误

org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:965)
    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:1059)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:304)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)

在此配置中我错过了什么吗?我也尝试使用.jks证书文件。但是,问题没有解决。

0 个答案:

没有答案