I have done some research around this with conflicting results. To handle this error, some say that I need to implement HandlerExceptionResolver
in one of my controllers.
Here are some links for that:
- How to handle MaxUploadSizeExceededException
- Handling MaxUploadSizeExceededException with Spring MVC
- http://www.raistudies.com/spring/spring-mvc/file-upload-spring-mvc-annotation/
On the other hand, other people are saying that this approach is futile such that the Exception
is occuring outside the request handling flow:
- http://forum.spring.io/forum/spring-projects/web/124409-handling-maxuploadsizeexceededexception-in-spring (The second poster in the thread)
- MaxUploadSizeExceededException doesn't invoke the exception handling method in Spring
I have tried the above solutions but they do not work for me. It appears that the Exception
occurs outside of Spring, as expected. I am unable to catch this even with HandlerExceptionResolver
.
HandlerExceptionResolver
and also please state which specific spring version you are using. – CaHandlerExceptionResolver
the expection should be handled correctly, see here please add your current implementation so we can check what is wrong – Prophesy