我正在运行 SpringBoot 应用程序
,刚刚检查了服务器日志,发现了几个这样的错误。我不明白是什么原因导致的,因为该错误每天都会在 12/24 小时后出现。
在 8.5.11
上运行的 Tomcat 版本
2018-03-04 17:03:26 [http-nio-8080-exec-85] INFO o.a.coyote.http11.Http11Processor - 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:421)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
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:748)
请您参考如下方法:
这可能是因为解析 HTTPS header 而不是 HTTP 造成的。尝试:
- 添加:
logging.level.org.springframework.web: 跟踪
logging.level.org.apache:跟踪
到你的 application.properties 看看 Spring 对你说了什么。 - 检查当时是否有任何计划的 Activity 引用其他由 SSL 加密的资源。另请参阅:java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens