码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot2.0 项目异常日志,但不影响运行

时间:2019-04-18 17:10:22      阅读:895      评论:0      收藏:0      [点我收藏+]

标签:头部   apach   kthread   runnable   ice   配置文件   out   connect   tor   

第一段:

2019-04-16 21:05:22 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]
2019-04-16 21:19:13 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]
2019-04-17 01:46:33 [INFO] [org.apache.juli.logging.DirectJDKLog:175] - Error parsing HTTP request header
 Note: further occurrences of HTTP request 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:414)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:294)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	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)
2019-04-17 02:49:43 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]

第二段:

2019-04-18 02:08:43 [INFO] [org.apache.juli.logging.DirectJDKLog:175] - Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:467)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:294)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	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)
2019-04-18 02:44:42 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]
2019-04-18 02:47:57 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]
2019-04-18 05:26:21 [WARN] [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver:197] - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not parse ‘Accept‘ header [/]: Invalid mime type "/": does not contain subtype after ‘/‘]

看下网上的解决方案:

(1)原因是Tomcat的header缓冲区大小不够,只需要在 server.xml 中增加 maxHttpHeaderSize 字段即可:

<Connector connectionTimeout="20000" maxHttpHeaderSize="10000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

我是在 SpringBoot 中的配置文件添加了:

server.max-http-header-size=16KB

(2)头部包含了特殊字符的原因:

Tomcat 7.0.81以上支持,打开conf/catalina.properties在底部将

#tomcat.util.http.parser.HttpParser.requestTargetAllow=|

修改为

tomcat.util.http.parser.HttpParser.requestTargetAllow=|,{,}

 

SpringBoot2.0 项目异常日志,但不影响运行

标签:头部   apach   kthread   runnable   ice   配置文件   out   connect   tor   

原文地址:https://www.cnblogs.com/wbxk/p/10730296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!