HTTP2.0的技术构架总结 与 Nginx和Tomcat配置HTTP2.0( 三 )

解决方法一(没行通)我们需要关注这个参数:sslImplementationName
sslImplementationName The class name of the SSL implementation to use. If not specified and the tomcat-native library is not installed, the default of org.apache.tomcat.util.net.jsse.JSSEImplementation will be used which wraps JVM's default JSSE provider. Note that the JVM can be configured to use a different JSSE provider as the default. Tomcat also bundles a special SSL implementation for JSSE that is backed by OpenSSL. To enable it, the native library should be enabled as if intending to use the APR connector, and Tomcat will automatically enable it and the default value of this attribute becomes org.apache.tomcat.util.net.openssl.OpenSSLImplementation. In that case, the attributes from either JSSE and OpenSSL configuration styles can be used, as long as the two types are not mixed (for example, it is not allowed to define use of a Java keystore and specify a separate pem private key using the OpenSSL attribute).当我们没有安装 tomcat-native  , 将默认使用 org.apache.tomcat.util.net.jsse.JSSEImplementation , 但是这个是不支持 ALPN , 也就不支持 http2.0了 。看官方说到我可以配置 sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation"  , 但是我进行配置这个启动就失败了
org.apache.catalina.LifecycleException: 初始化组件[Connector[HTTP/1.1-8443]]失败 。at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139)at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)at org.apache.catalina.startup.Catalina.load(Catalina.java:639)at org.apache.catalina.startup.Catalina.load(Catalina.java:662)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:303)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473) Caused by: java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.Pool.create(J)Jat org.apache.tomcat.jni.Pool.create(Native Method)方法二(可行)安装 tomcat-native,只要本地安装了 tomcat-native  , 就会默认使用 openssl. 虽然我们没有开启 ARP
yum installopenssltomcat-native-yTomcat 开启ARP 文章因此我建议 , 你在 java 8的 环境下需要使用 h2 的话 , 需要做到以下几点

  1. 安装 openssl 大于等于 1.0.2 。
  2. 使用 Tomcat 8.5
  3. 安装 tomcat-native 。

【HTTP2.0的技术构架总结 与 Nginx和Tomcat配置HTTP2.0】


推荐阅读