Tomcat9配置http2报错:Invalid character (CR or LF) found in method name

西夏一品堂 发布于 2016/04/21 12:05
阅读 18K+
收藏 0

tomcat版本:apache-tomcat-9.0.0.M4

JDK:1.8.0_77

操作系统:ubuntu x64 16.04

证书生成方式如下(openssl版本:OpenSSL 1.0.2g  1 Mar 2016):

openssl genrsa -out server.key 2048 
openssl rsa -in server.key -out server.key 

openssl req -new -x509 -key server.key -out ca.crt -days 3650 

tomcat 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="ssl/server.key"
                         certificateFile="ssl/ca.crt"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

tomcat启动的时候,报了两个错误

20-Apr-2016 20:35:06.584 SEVERE [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Failed to initialize the SSLEngine.
 org.apache.tomcat.jni.Error: 70023: This function has not been implemented on this platform
	at org.apache.tomcat.jni.SSL.initialize(Native Method)
	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.core.AprLifecycleListener.initializeSSL(AprLifecycleListener.java:284)
	at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:136)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
	at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:104)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	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:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)

20-Apr-2016 20:35:06.922 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
20-Apr-2016 20:35:06.948 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
20-Apr-2016 20:35:06.958 INFO [main] org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The ["https-apr-8443"] connector has been configured to support negotiation to [h2] via ALPN
20-Apr-2016 20:35:06.959 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-apr-8443"]
20-Apr-2016 20:35:06.981 WARNING [main] org.apache.tomcat.util.net.openssl.OpenSSLEngine.<clinit> Failed getting cipher list
 java.lang.Exception: Not implemented
	at org.apache.tomcat.jni.SSL.newSSL(Native Method)
	at org.apache.tomcat.util.net.openssl.OpenSSLEngine.<clinit>(OpenSSLEngine.java:81)
	at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:363)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:798)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:547)
	at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:66)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:1010)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
	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:311)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)



但是,不影响启动,tomcat已经正常启动了

8080,8443端口已经正常在监听

8080 的http方式可以访问,但是,8443方式访问不了

查看tomcat日志,报如下错误

20-Apr-2016 20:36:01.511 INFO [https-apr-8443-exec-5] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
 java.lang.IllegalArgumentException: Invalid character (CR or LF) found in method name
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:443)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:982)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:760)
	at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2278)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)



请问,哪里错了,怎么解决
加载中
1
西夏一品堂
西夏一品堂

已经搞定了。谢谢大家

http://blog.csdn.net/mn960mn/article/details/51602529

0
叫我刀刀
叫我刀刀
你们真先进,tomcat9 jdk8,我这还tomcat6 jdk5,感觉被时代狠狠的抛弃了
0
曾陈伟不wei
曾陈伟不wei
哈哈哈哈,我也是看到tomcat9进来的,感觉太先进了,感觉我们tomcat7 jdk7已经不主流了
0
宝芝林后厨五星面点师
宝芝林后厨五星面点师

我也遇到了

五月 18, 2016 11:07:47 上午 org.apache.coyote.http11.AbstractHttp11Processor process 信息: Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character (CR or LF) found in method name
不过我是替换了 tcnative-1.dll 修改了 server.xml配置  不知道什么导致的
宝芝林后厨五星面点师
宝芝林后厨五星面点师
回复 @西夏一品堂 : 反正用notepad++ 把server.xml 在 windows格式和Unix格式之间来回转下 就没这问题了 具体原因没找到说法
西夏一品堂
西夏一品堂
这个问题你解决了吗?
0
zcdnsz
zcdnsz
tomcat9现在是测试版 还是正式版?
西夏一品堂
西夏一品堂
最新的版本是:Tomcat 9.0.0.M8 (alpha)
返回顶部
顶部