上传文件过大,出现 MaxUploadSizeExceededException 异常
nested exception is : Maximum upload size of 5242880 bytes exceeded;
nested exception is $SizeLimitExceededException: the request was rejected because its size (5845210) exceeds the configured maximum (5242880)] with root cause
$SizeLimitExceededException: the request was rejected because its size (5845210) exceeds the configured maximum (5242880)
异常处理方法
1、 配置tomcat/conf/,添加maxSwallowSize=”-1”
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
maxSwallowSize="-1"
redirectPort="8443" />
2、SpringMVC 配置 CommonsMultipartResolver属性,添加resolveLazily=”true”
<bean id="multipartResolver"
class="">
<property name="defaultEncoding" value="UTF-8"/>
<property name="maxUploadSize" value="20971520"/>
<property name="resolveLazily" value="true"/>
</bean>