org.apache.tomcat.util.http.fileupload.FileUploadBase $ FileSizeLimitExceededException [英] org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException
问题描述
如何处理
java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase $ FileSizeLimitExceededException: 字段fileName超过其最大允许大小3145728 字节.
java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field fileName exceeds its maximum permitted size of 3145728 bytes.
在上传大于servlet @MultipartConfig中的maxFileSize限制的文件后,会发生这种情况.有没有一种方法可以加载浏览器自定义错误页面或其他内容,因为该客户端收到
This happens after uploading a file which is bigger than maxFileSize limit in servlet @MultipartConfig. Is there a way to load in browser custom error page or something else because after that client recievs
连接已重置
The connection was reset
推荐答案
我猜测普通的servlet错误页面机制应该可以解决此问题,因此请将其添加到web.xml
:
I'm guessing the normal servlet error-page mechanism should catch this, so add this to web.xml
:
<error-page>
<error-code>500</error-code>
<location>/internalerror.html</location>
</error-page>
或捕获任何错误代码,只需省略<error-code>
标记:
or to catch any error code, just leave out the <error-code>
tag:
<error-page>
<location>/anyerror.html</location>
</error-page>
这篇关于org.apache.tomcat.util.http.fileupload.FileUploadBase $ FileSizeLimitExceededException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!