1

I'm debugging a Spring Boot application, but am finding it extremely difficult to do so because my code isn't printing any stack traces: no stack trace printed for ArrayOOB exception, so I have no idea where it happened

What in the world is ExceptionHandlerExceptionResolver, and does it have to do with my issue?

1 Answer 1

2

ExceptionHandlerExceptionResolver matches uncaught exceptions against suitable @ExceptionHandler methods on both the handler (controller) and on any controller-advices.

For more details https://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc##extending-exceptionhandlerexceptionresolver

I was facing the same issue as you. In my case is I use @ControllerAdvice and I did not have the Exception.class handler case.

When I added it, the stacktrace is printed again.

@ExceptionHandler(Exception.class)
@ResponseBody
public ResponseEntity<Object> handleException(Exception e) {
    LOGGER.error("Exception: {}", e);
    // your handler code.
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.