org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

Posted 优秀不够,你是否无可替代

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header相关的知识,希望对你有一定的参考价值。

07-Jan-2018 14:28:44.765 INFO [http-nio-8080-exec-8] 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 found in method name. HTTP method names must be tokens at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:406) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:380) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1374) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)

查看日志发现上面那一段.百度一下说是Tomcat的header缓冲区大小不够,需要在server.xml中增加maxHttpHeaderSize字段,设置一下.还有人说换一个版本的tomcat就可以了,我觉得那根本不是问题的原因好吧…..

下面一段是网上摘取的内容,测试一下是否可以解决问题:

//********************************************************************************************************************************************

<Connector URIEncoding="UTF-8" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" useBodyEncodingForURI="false" enableLookups="false" connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="你想要的大小"/>

tomcat常用配置注释:

maxHttpHeaderSize="8192" http请求头信息的最大程度,超过此长度的部分不予处理。一般8K。

URIEncoding="UTF-8" 指定Tomcat容器的URL编码格式。

disableUploadTimeout="true" 上传时是否使用超时机制

enableLookups="false"--是否反查域名,默认值为true。

为了提高处理能力,应设置为false compression="on" 打开压缩功能

compressionMinSize="10240" 启用压缩的输出内容大小,默认为2KB

noCompressionUserAgents="gozilla, traviata" 对于以下的浏览器,不启用压缩

compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" 哪些资源类型需要压缩 tomcat配置示例: 配置示例

<Connector

port="8080"

redirectPort="8443"

maxThreads="150"

minSpareThreads="25"

maxSpareThreads="75"

acceptCount="100"

connectionTimeout="20000"

protocol="HTTP/1.1"

maxHttpHeaderSize="8192"

URIEncoding="UTF-8"

disableUploadTimeout="true"

enableLookups="false"

compression="on"

compressionMinSize="10240"

noCompressionUserAgents="gozilla, traviata"

compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain">

...

</Connector>

 

以上是关于org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header的主要内容,如果未能解决你的问题,请参考以下文章

服务器:[http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service 处理请求时出错 java.lang.NullPo

tomcat启动优化

Tomcat 隐藏Server Name

tomcat https支持是否不支持pem格式证书

启动tomcat出现如下字符就不动了!!急!!在线等!!高分

求高手解决严重: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException