With the caveat that I looked at things for all of 30 seconds so I could
be WAY wrong...

Looking at the Struts source, the RequestProcessor.processException()
method is where your custom handler gets called from.  I notice that the
request attribute is NOT set there.  In fact, there is no reference to
EXCEPTION_KEY in the RP.  So, where is it set?

Looks to me like it gets set in the ExceptionHandler.execute() method. 
But, since you will extend this class to create your own handler and
override execute(), you have to, unless I'm missing something, set the
request attribute yourself.

So, my theory is that the half of the time the type of exception occurring
is not Throwable, in which case the default handler would execute and the
exception key would get set, the other time your own handler fires and it
doesn't get set.

No, wait, I'm not sure that makes sense... where you say "my code looks
like this", is this the code in whatever err100.do maps to (an Action I
assume)?  If so, then maybe this does make sense.

Well, even if I am wrong, I think there is an easy way to find out... add
the line:

request.setAttribute(Globals.EXCEPTION_KEY, ex);

...in your handler and see if your problem goes away.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

On Thu, February 2, 2006 12:49 pm, Michael Davis said:
> 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]

Reply via email to