我將項目部署在tomcat服務器上,原本都是好好的,輸入網站地址就能訪問;可是次日一早去就會發現網站訪問提示404,文件沒法找到;我就很懵了。java
22-Sep-2019 18:15:22.184 INFO [http-nio-8080-exec-7] 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:426)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
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)chrome
在Tomcat的server.xml中找到apache
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>
這個標籤,添加maxHttpHeaderSize="9999"
這一屬性。瀏覽器
<Connector executor="tomcatThreadPool" maxHttpHeaderSize="9999" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
過了幾天依然出現了這個錯誤。tomcat
忽然發現本身的服務器是開了兩個tomcat,雖然端口號各不相同,但有沒多是這個形成的緣由呢?服務器
而後我關閉其中一個,如今過去大半個月了,依舊正常運行。app