FileUploadBase$SizeLimitExceededException apache tomcat [英] FileUploadBase$SizeLimitExceededException apache tomcat

查看:79
本文介绍了FileUploadBase$SizeLimitExceededException apache tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 JSP 文件上传文件,但在 catalina.out 中出现以下错误.正如许多博客中指定的那样,我增加了 webapps/manager/WEB-INF/web.xml 下的 max-file-size 但仍然有同样的问题......我应该在哪里增加它来解决这个错误?

Im trying to upload file from a JSP file and I get the following error in catalina.out. As specified in many blogs, I increased the the max-file-size under webapps/manager/WEB-INF/web.xml but still I have the same problem...Where should I increase it to resolve this error?

<multipart-config>
      <!-- 50MB max -->
      <max-file-size>5242880000000</max-file-size>
      <max-request-size>5242880000000</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (341297) exceeds the configured maximum (51200)

推荐答案

我遇到了同样的问题.我通过在位于 <tomcat-root-folder>/conf/server.xml 的 http 服务器 tomcat 连接器中设置参数 maxPostSize 来解决它,如下所示:

I had the same problem. I solved it by setting the parameter maxPostSize in the http server tomcat connector located in <tomcat-root-folder>/conf/server.xml as follows:

<Connector connectionTimeout="20000" 
           port="8080" 
           protocol="HTTP/1.1" 
           redirectPort="8443" 
           maxPostSize="52428800" />

maxPostSize 设置为52428800 将上传文件大小增加到50 MB.默认情况下,它设置为 2 MB.

Set maxPostSize to 52428800 increase the upload file size to 50 MB. By default it's set to 2 MB.

更多解释,请阅读:https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

这篇关于FileUploadBase$SizeLimitExceededException apache tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆