The ExceptionInInitializerError stack trace only goes to the initialization
in which the exception occurred. I usually need to see the original exception
to actually fix the problem, but that is only stored in the exception -- it is
not displayed. I include below my fix, which is to modify the exception's
printStackTrace methods to print the nested exception's stack trace, but other
solutions exist. Please do something about it.
public void printStackTrace() {
printStackTrace(System.err);
}
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
s.println("Exception was ");
exception.printStackTrace(s);
}
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
s.println("Exception was ");
exception.printStackTrace(s);
}
in which the exception occurred. I usually need to see the original exception
to actually fix the problem, but that is only stored in the exception -- it is
not displayed. I include below my fix, which is to modify the exception's
printStackTrace methods to print the nested exception's stack trace, but other
solutions exist. Please do something about it.
public void printStackTrace() {
printStackTrace(System.err);
}
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
s.println("Exception was ");
exception.printStackTrace(s);
}
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
s.println("Exception was ");
exception.printStackTrace(s);
}
- duplicates
-
JDK-4074663 ExceptionInInitializer causes obscure stack traces.
-
- Closed
-
-
JDK-4086065 rfe: Method.invoke() is difficult to debug
-
- Closed
-
- relates to
-
JDK-6604085 REGRESSION: InvocationTargetException doesn't print chained exception's stack trace
-
- Closed
-