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

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

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

相关文章
|
3月前
|
数据库
java.sql.SQLException: txn too large, size: 104857606.
该博客文章讨论了在TiDB数据库中遇到的"txn too large"错误,原因是事务大小超过了默认限制,解决方案是减少每次删除操作的数据量以降低事务的总大小。
86 0
|
6月前
|
Java 应用服务中间件 Spring
SpringBoot出现 java.lang.IllegalArgumentException: Request header is too large 解决方法
SpringBoot出现 java.lang.IllegalArgumentException: Request header is too large 解决方法
239 0
|
4月前
|
消息中间件 Java Maven
java.util.zip.ZipException: invalid LOC header (bad signature)
java.util.zip.ZipException: invalid LOC header (bad signature)
61 1
|
6月前
|
Java 微服务
Java错误:微服务报错Cannot execute request on any known serve
Java错误:微服务报错Cannot execute request on any known serve
|
6月前
|
前端开发 Java 应用服务中间件
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
532 0
|
6月前
|
存储 前端开发 Java
JavaWeb:Request & Response
在JavaWeb开发中,Request(请求)和Response(响应)是非常重要的概念。它们分别代表着客户端向服务器发送请求和服务器向客户端返回响应的过程。Request对象是由服务器创建的,用于封装来自客户端的请求信息。它包含了请求的HTTP方法(如GET或POST),URL,请求头部、参数等信息。你可以通过Request对象获取客户端发送的表单数据、URL参数、HTTP头部和Cookies等。Response对象则是服务器用来向客户端发送响应的工具。它包含了HTTP状态码、响应头部和响应体等信息。你可以使用Response对象设置响应的状态码、设置响应头部
89 3
 JavaWeb:Request & Response
|
6月前
|
Java 应用服务中间件
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro 错误处理
98 0
|
6月前
|
Oracle 安全 Java
[Java] `JDK17` 模式变量 `Pattern variable` Variable ‘request‘ can be replaced with pattern variable
[Java] `JDK17` 模式变量 `Pattern variable` Variable ‘request‘ can be replaced with pattern variable
|
6月前
|
Java
【Java报错】MultipartFile 类型文件上传 Current request is not a multipart request 问题处理(postman添加MultipartFile)
【Java报错】MultipartFile 类型文件上传 Current request is not a multipart request 问题处理(postman添加MultipartFile)
625 0
|
存储 API
10JavaWeb基础 - Request类
10JavaWeb基础 - Request类
59 0
下一篇
无影云桌面