fileupload.FileUploadBase$SizeLimitExceededException

fileupload.FileUploadBase$SizeLimitExceededException

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

If you are getting below exception:

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (6690976) exceeds the configured maximum (100000)
    org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:937)
    org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
    org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
    org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
    org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:156)
    org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:139)
    org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1020)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:883)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

Solution: If you are trying to upload file using Spring it means maxUploadSize value less than uploaded file size. Use below property tag to increase or decrease file upload size:

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

Leave a Reply

Your email address will not be published. Required fields are marked *