I’ve encountered a strange thing. I have configured exception handling in struts 2.1.8 like stated here, only that I redirect to an action instead to JSP (to send emails…).
So, in the action I have
ActionContext ac = ActionContext.getContext();
String stackTrace = null;
if(ac.getValueStack().findValue("exceptionStack") != null) {
stackTrace = ac.getValueStack().findValue("exceptionStack").toString();
} else {
stackTrace = "Stack trace not found!";
}
I had to make this if-else because sometimes the value is null. I haven’t found the difference why sometimes I get the stack trace and sometimes I don’t. All the errors happen in Struts2.
Did anyone had similar problem? Can anybody directs me where is the problem?
if you map exception with chain result type you’ll keep the same request and so the same ValueStack.