I was hoping to implement a single "ExceptionController" to handle exceptions that are thrown when other methods of my controllers execute. I did not specify HandlerExceptionResolver in my application context, so AnnotationMethodHandlerExceptionResolver should be triggered according to the API documentation . I checked it as such in the source. So why doesn't the following work?
@Controller public class ExceptionController { @ExceptionHandler(NullPointerException.class) public ModelAndView handleNullPointerException(NullPointerException ex) {
In the debug logs, I see that three exception handlers are requested by default to handle the exception, but nothing has been done, and I see that "DispatcherServlet - request failed." After that, the user displays the stack and internal error 500.
java spring-mvc exception-handling
predhme
source share