I am considerably new with Spring, and I want to have a multipart form and handle the MaxUploadSizeExceededException exception in order to show an error message in the jsp.
After investigating, the problem was due to Tomcat.
In the version 7.0.55 was introduced the property maxSwallowSize set by default to 2MB. This made Tomcat to abort the upload request. By setting this attribute to another value the problem is solved (I changed it to -1, please do not do that in your PRD environment as Tomcat will really try to get a X MB file to upload). I did this by adding in my Tomcat server file ${tomcat_dir}/conf/server.xml in my connector property the attribute maxSwallowSize
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxSwallowSize="-1"/>
You need to restart Tomcat so it takes this configuration, if does not work, delete the server and add it again.