Tomcat9配置http2报错:Invalid character (CR o?报错-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

Tomcat9配置http2报错:Invalid character (CR o?报错

2020-06-09 15:43:47 320 1

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)
  • 爱吃鱼的程序员
    2020-06-09 15:44:04

    已经搞定了。谢谢大家

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

    你们真先进,tomcat9jdk8,我这还tomcat6jdk5,感觉被时代狠狠的抛弃了哈哈哈哈,我也是看到tomcat9进来的,感觉太先进了,感觉我们tomcat7jdk7已经不主流了

    我也遇到了

    五月18,201611:07:47上午org.apache.coyote.http11.AbstractHttp11Processorprocess信息:ErrorparsingHTTPrequestheaderNote:furtheroccurrencesofHTTPheaderparsingerrorswillbeloggedatDEBUGlevel.java.lang.IllegalArgumentException:Invalidcharacter(CRorLF)foundinmethodname
    不过我是替换了 tcnative-1.dll修改了server.xml配置 不知道什么导致的回复 @西夏一品堂:反正用notepad++把server.xml在windows格式和Unix格式之间来回转下就没这问题了具体原因没找到说法这个问题你解决了吗?tomcat9现在是测试版还是正式版?最新的版本是:Tomcat9.0.0.M8(alpha)
    0 0
相关问答

162

回答

惊喜翻倍:免费ECS+免费环境配置~!(ECS免费体验6个月活动3月31日结束)

豆妹 2014-10-29 17:52:21 226212浏览量 回答数 162

8

回答

OceanBase 使用动画(持续更新)

mq4096 2019-02-20 17:16:36 337075浏览量 回答数 8

111

回答

OSS存储服务-客户端工具

newegg11 2012-05-17 15:37:18 295634浏览量 回答数 111

22

回答

爬虫数据管理【问答合集】

我是管理员 2018-08-10 16:37:41 147265浏览量 回答数 22

18

回答

阿里云开放端口权限

xcxx 2016-07-20 15:03:33 646852浏览量 回答数 18

31

回答

[@倚贤][¥20]刚学完html/css/js的新手学习servlet、jsp需要注意哪些问题?

弗洛伊德6 2018-10-27 21:52:43 146063浏览量 回答数 31

38

回答

安全组详解,新手必看教程

我的中国 2017-11-30 15:23:46 259889浏览量 回答数 38

294

回答

Linux Bash严重漏洞修复紧急通知(已全部给出最终修复方案)

qilu 2014-09-25 13:26:50 434624浏览量 回答数 294

249

回答

阿里云LNAMP(Linux + Nginx + Apache + MySQL + PHP)环境一键安装脚本

云代维 2014-02-14 15:26:06 305683浏览量 回答数 249

24

回答

【精品问答】python技术1000问(1)

问问小秘 2019-11-15 13:25:00 475833浏览量 回答数 24
+关注
爱吃鱼的程序员
https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
2
文章
21569
问答
问答排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载