前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >13.8 java.lang.IllegalArgumentException: Request header is too large13.8 java.lang.IllegalArgumentEx

13.8 java.lang.IllegalArgumentException: Request header is too large13.8 java.lang.IllegalArgumentEx

作者头像
一个会写诗的程序员
发布2018-08-20 09:39:41
5190
发布2018-08-20 09:39:41
举报

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017.05.06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 13.8 java.lang.IllegalArgumentException: Request header is too large
  • 问题日志:java.lang.IllegalArgumentException: Request header is too large
  • 解决方案
  • 原因分析:
  • 解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档