dimanche 22 février 2015

Getting MaxUploadSizeExceededException in my spring application

Currently I am working on Spring application which uses spring veriosn as 3.2.12.RELEASE, tomcat 7, Servlet 3.0 and getting the 'MaxUploadSizeExceededException' in tomcat console when I tries to upload file with size more than 2MB. Its working fine for the files less than 2MB size.


I have configured CustomMultipartResolver as below which extends CommonMultipartResolver in turn:-


Configured below bean entity. Configured maxUploadSize to 200 MB



<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CustomsMultipartResolver">
<property name="maxUploadSize" value="209715200" />
</bean>


But my control is not coming inside this class and simply goes into resolveMultipart method of StandardServletMultipartResolver class. For the file with size more than 2MB, the method request.getPart() method throws IllegalStateException and finally getting SizeLimitExceededException.


I also tried by adding below code in my web.xml but it also didn't work



<multipart-config>
<!-- 200MB max -->
<max-file-size>209715200</max-file-size>
<max-request-size>209715200</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>


Its working fine with same configuration except if I use spring version 3.0.5.RELEASE where there is no class StandardServletMultipartResolver and the control correctly goes into my CustomMultipartResolver and I could upload file with size upto 200 MB.


I couldn't proceed because of this.


Aucun commentaire:

Enregistrer un commentaire