struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Wannemacher <>
Subject Re: Struts 2.0 to 2.1 Migration problem
Date Thu, 31 Dec 2009 16:10:01 GMT
On Thu, Dec 31, 2009 at 10:53 AM, bberken <> wrote:


>        <error-page>
>                <exception-type>java.lang.Exception</exception-type>
>                <location>/WEB-INF/jsp/Error.jsp</location>
>        </error-page>


> struts.xml global-results:
>              <global-results>


>                        <result name="error" type="dispatcher">/WEB-INF/jsp/Error.jsp</result>


My guess is that the exception is being caught by the Application
Server. If the dispatcher / filter isn't run against the request, the
Container will be unavailable. Topics similar to this have come up in
the past, but I can't remember the exact solution. There are a few
ways to view the "solution" to your problem. For one, if you want to
catch *all* errors and use the error-page in the web.xml, then don't
use any struts tags in there. This is my preferred method, simply
because the error could come from deep in the darkest trenches of the
framework (or another framework - i.e. Hibernate / Spring
filters/listeners). It's a bit of a chicken-and-egg problem. If you
want absolute certainty, then take the tags out of your error page.

Another approach is to create a graph of exception-mappings -

Which it looks like you have attempted to do. However, I don't think
using "Throwable" is enough. When you have the problem, do you see a
stack-trace in the application server console? There is bound to be
another exception that happens beforehand that is causing the "error"
result to be dispatched to... Basically, the NPE is a result of the
"error" result attempt, so what is the cause of the "error" result?
(hint, it isn't the NPE, it'll most likely be in your application
server logs).

Once you track that down, you can solve this particular problem, but
long-term, I don't think your exception-mapping will work 100% of the
time, you will find situations like this that are simply outside of
the scope of Struts to handle.


Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message