13.8 java.lang.IllegalArgumentException: Request header is too large

来源:互联网 发布:联想有windows系统平板 编辑:程序博客网 时间:2024/06/06 04:15

13.8 java.lang.IllegalArgumentException: Request header is too large

问题日志:java.lang.IllegalArgumentException: Request header is too large

java.lang.IllegalArgumentException: Request header is too large    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:701)    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:455)    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:745)

解决方案

配置 tomcat server xml

<Connector port="8080" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8443" maxHttpHeaderSize="65536" maxPostSize="4194304"                 URIEncoding="UTF-8"/>

org.apache.coyote.http11.AbstractHttp11Protocol

原因分析:

在tomcat的org.apache.coyote.http11.AbstractHttp11Protocol类中定义了其默认值:

    /**     * Maximum size of the HTTP message header.     */    private int maxHttpHeaderSize = 8 * 1024;

所以,当请求头大于 8 * 1024,就会报错。针对这样的大数据量的请求,需要单独配置这个maxHttpHeaderSize的值。

解决方案

在application.properties里面配置一下maxHttpHeaderSize的值:

server.max-http-header-size=1048576# Maximum number of connections that the server will accept and process at any given time.server.tomcat.max-connections= 3000# Maximum size in bytes of the HTTP post content.server.tomcat.max-http-post-size=1048576# Maximum amount of worker threads.server.tomcat.max-threads=1000

参考:
http://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html

阅读全文
0 0
原创粉丝点击