首页 > 其他分享 >Spring上传文件报错the request was rejected because its size (15920203) exceeds the configured maximum (104

Spring上传文件报错the request was rejected because its size (15920203) exceeds the configured maximum (104

时间:2022-10-21 08:22:37浏览次数:87  
标签:core catalina java Spring configured 报错 apache org ApplicationFilterChain

背景

今天在查异常日志的时候,发现了一条这样的报错

the request was rejected because its size (15920203) exceeds the configured maximum (10485760)

详细堆栈如下:

org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (15920203) exceeds the configured maximum (10485760)
at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:802)
at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:256)
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:280)
at org.apache.catalina.connector.Request.parseParts(Request.java:2884)
at org.apache.catalina.connector.Request.parseParameters(Request.java:3232)
at org.apache.catalina.connector.Request.getParameter(Request.java:1137)
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
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)

解决办法

在阅读官方手册后:https://spring.io/guides/gs/uploading-files/

所以我们在application.yml或application.properties中增加配置中增加配置,将最大上传文件大小调整成100MB

---
spring:
  servlet:
    multipart:
      enabled: true
      max-file-size: 100MB
      max-request-size: 100MB

  

本篇文章如有帮助到您,请给「翎野君」点个赞,感谢您的支持。

首发链接:https://www.cnblogs.com/lingyejun/p/16812226.html

标签:core,catalina,java,Spring,configured,报错,apache,org,ApplicationFilterChain
From: https://www.cnblogs.com/lingyejun/p/16812226.html

相关文章

  • sentinel运行报错问题处理:Unable to make protected final java.lang.Class java.lan
    使用命令:java-jarsentinel-dashboard-1.8.3.jar启动后异常情况如下java.lang.IllegalStateException:Cannotloadconfigurationclass:com.alibaba.csp.sentinel.das......
  • SpringMVC
    基本使用:1.使用springMVC技术需要先导入servlet和springMVC(spring-webmvc)坐标2.创建一个springMVC的控制器类(等同于servlet功能)@controller是springMVC专属的,@RequestMap......
  • Spring Batch 中的 chunk
    我们都知道SpringBatch有2种任务方式。主要是在Step阶段,在Step阶段,我们可以执行一个Tasklet,我们也可以按照Chunk来执行。主要区别如果使用Tasklet的话,我们可......
  • Spring Batch 中的 chunk
    我们都知道SpringBatch有2种任务方式。主要是在Step阶段,在Step阶段,我们可以执行一个Tasklet,我们也可以按照Chunk来执行。主要区别如果使用Tasklet的话,我......
  • Spring中Transactional注解使用的心得
    今天看黑马redis的课,里面讲到了一个事务注解不生效的问题。究其原因,就在于Spring中事务注解生效的条件。那么接下来就说一下自己的心得。查了一下资料,就是说如果想让@Tr......
  • springMvc路径参数映射原理
     一、springMvc 执行流程图 二、springMvc中url映射接口关键点2.1:AbstractHandlerMappingorg.springframework.web.servlet.handler.AbstractHandlerMapping#getHa......
  • 基于springboot高考填报志愿综合参考系统设计与实现-计算机毕业设计源码+LW文档
    摘要:高考填报志愿综合参考系统是针对目前高考填报志愿管理的实际需求,从实际工作出发,对过去的高考填报志愿综合参考系统存在的问题进行分析,完善用户的使用体会。采用计算机系......
  • SpringBoot+MybatisPlus--文件上传和下载实例
    文件上传时,file是一个临时文件,需要转存到指定位置,否则本次请求完成后临时文件就被删除Controller后台代码:packagecom.itheima.reggie.controller;importcom.itheima......
  • springboot 整合websocket
    1.             name用于确定给谁发消息的一个标识     ......
  • Spring cloud sentinel哨兵
                                                         ......