0%

Invalid character found in method name. HTTP method names must be tokens

问题截图

异常内容

1
2
3
4
5
6
7
8
9
10
11
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:422)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:683)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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)

解决方案

 Tomcat的header缓冲区大小不够,只需要在server.xml中增加maxHttpHeaderSize字段即可

1
2
3
4
<Connector port="80" protocol="HTTP/1.1"
maxHttpHeaderSize="8192"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>