I use a @ControllerAdvice for my REST service. However I can not get a full stacktrace and define where an exception occured.
My ControllerAdvice:
@ControllerAdvice
public class RestResponseEntityExceptionHandler
extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = {Exception.class})
protected ResponseEntity<Object> handleException(
Exception ex, WebRequest request) {
String bodyOfResponse = "Internal error";
System.out.println(ex.toString());
return handleExceptionInternal(ex, bodyOfResponse,
new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
}
If an Exception occurs I receive only:
WARN 72490 --- [nio-5054-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.NullPointerException]
How I can get a full stacktrace?