2 apbbbbb apbbbbb 于 2016.09.08 11:01 提问

我上传文件时报不能大于10M,我配置文件已经修改了,怎么解决????

Caused by: org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: UT000020: Connection terminated as request was larger than 10485760
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:165) [spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:142) [spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1067) [spring-webmvc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:906) [spring-webmvc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) [spring-webmvc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) [spring-webmvc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
... 57 more
Caused by: org.apache.commons.fileupload.FileUploadException: UT000020: Connection terminated as request was larger than 10485760
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:369) [commons-fileupload-1.2.jar:1.2]
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) [commons-fileupload-1.2.jar:1.2]
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:158) [spring-web-4.0.6.RELEASE.jar:4.0.6.RELEASE]
... 62 more

这是我的配置文件
<bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <!-- one of the properties available; the maximum file size in bytes -->
    <property name="maxUploadSize" value="99999999999" />
</bean> 

2个回答

u013829202
u013829202   Rxr 2016.09.08 13:03

我也不懂。 提个建议,检查下:配置文件有设置,代码中有设置吗? 有的是双重。

apbbbbb
apbbbbb 本地测试没有问题,项目打包部署到服务器上就报这错
大约一年之前 回复
apbbbbb
apbbbbb 检查了<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- one of the properties available; the maximum file size in bytes --> <property name="maxUploadSize" value="99999999999" /> </bean> 我还估计将value设置了大一点
大约一年之前 回复
qq_23039605
qq_23039605   2016.09.08 16:45

应该是在 multipartResolver 解析器里,设置了 maxUploadSize 这个属性。

apbbbbb
apbbbbb 但是把项目打包上传到jboss服务器上面,就限制了大小,不知道是不是服务器的原因
大约一年之前 回复
apbbbbb
apbbbbb 对的,<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- one of the properties available; the maximum file size in bytes --> <property name="maxUploadSize" value="99999999999" /> </bean> 我在本地测试没有问题
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片