Maybe it happens when the error is not thrown by Struts, so try to use
the JSP directive <%@ page isErrorPage="true" %> which give you access
to the implicit variable exception.
You can also use a exception handler :
<exception type="java.lang.Throwable"
key="error.error"
path="/err100.do"
handler="com.ddd.GlobalExceptionHandler"/>
package com.ddd;
public class GlobalExceptionHandler extends ExceptionHandler {
public ActionForward execute(Exception ex,
ExceptionConfig exConfig,
ActionMapping mapping,
ActionForm formInstance,
HttpServletRequest request,
HttpServletResponse response) throws ServletException {
/* your custom code */
return super.execute(ex, exConfig, mapping, formInstance,
request, response);
}
Vlad
Michael Davis wrote:
Hello,
I'm working on a struts application which has just been deployed and is
being used by a large number of users. I've got an error handler set up
using the global-exceptions tag. It sends me an email whenever it
catches an exception.
My config looks like this:
<global-exceptions>
<exception type="java.lang.Throwable"
key="error.error"
path="/err100.do"/>
</global-exceptions>
And my code does this:
Throwable e = (Throwable) request.getAttribute( Globals.EXCEPTION_KEY );
(remember that Globals.EXCEPTION_KEY is
"org.apache.struts.action.EXCEPTION").
Now my problem is that about half the time, e is null, so I can't
determine where the exception happened or even what it is.
Somehow struts is able to invoke my error handler, but sometimes does it
without setting Globals.EXCEPTION_KEY in the request. When does that
happen? How can I figure out what caused the error to happen?
thanks very much,
Michael from Ottawa
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]