I set the maximum file size
multipart.maxFileSize: 1mb multipart.maxRequestSize: 1mb
This is my controller:
@RequestMapping(method=RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @ResponseStatus(HttpStatus.CREATED) @Secured(Privileges.CAN_USER_READ) public void create(@RequestParam("file")final MultipartFile file,Principal principal) throws IllegalStateException, IOException,MultipartException{ medicalHistoryService.create(new MedicalHistory(file)); }
this error message
2016-03-03 13:48:24.560 WARN 4992 --- [nio-8080-exec-1] hcwRestResponseEntityExceptionHandler : Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (9288401) exceeds the configured maximum (1048576) 2016-03-03 13:48:25.545 WARN 4992 --- [nio-8080-exec-2] hcwRestResponseEntityExceptionHandler : Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (9288401) exceeds the configured maximum (1048576)
And the final result after the request with a large file is the problem loading page. I am not getting any other error in the stack trace, so I am a little fixated on what is actually happening. Oh yes, I tried many other solutions, such as registering a filter, handling exceptions in ErrorController. Every time I get the same result, the server crashes. 
EDIT 2
My exception handling class:
@ControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler{
}
source share