Hi Wes,
Appreciate your reply, thanks for checking the issue. I'm sure that my 
exception handling action class is not throwing an exception by itself. I have 
a general try-catch on that and it never falls to there. Actually the issue of 
chaining happens a little after that.. 
Let me explain
I have a login action class which throws a cast exception for some session 
object. Now my struts xml defined a global exception mapping as follows
        <global-results>
                        <result name="Excpetion" type="chain">
                                <param 
name="actionName">UnhandledExceptionHandler</param>
                        </result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" 
result="Excpetion"/>
        </global-exception-mappings>


        <action name="UnhandledExceptionHandler" 
class="com.timelink.falco.wui.struts.handlers.GlobalException">
                    <result name="error" 
type="dispatcher">/jsp/systemerror.jsp</result>
        </action>

The above config works, I mean the exception from my login action class is 
transferred to my -  GlobalException - exception handling class and the 
systemerror.jsp get displayed properly.

The problem is once this page gets displayed with data , now if the user goes 
and refresh this page from the browser, things getting wired!!

Frist thing is , even though the current displayed page is systemerror.jsp,
my url still points to the last class where the actual exception occurs 
(loginAction). I think this is because of chaining. 
Second, after the user did a refresh, it goes through the same path, it starts 
from the login action class -> the loin action throws the cast exception 
(java.lang subtype exception) -> my global redirect calls my GlobalException  
handler class execute method and return the result error as exactly as last 
time, but after that, this time instead of displaying the systemerror.jsp it 
will go to the Struts 500 infinite recursion error!!

Now if the user refresh that error page(struts 500) the same things happens as 
above and this time my  systemerror.jsp shows up, now you refresh that again it 
goes to struts 500, this is the sequence. All of the above refresh always goes 
through the exception generation process(starts from loginAction class) since 
the url always set to loginAction class.

I hope that explains it well. Please let me know where do I have to look for 
more info. I tried to branch those actions into 2 part action - like the global 
exception does the chain to my exception handling class (where I save the 
current exception state) and after it returns , instead of displaying the 
systemerror.jsp straight, I redirect that error result to another action 
class(this time using "redirectAction")
So that the url get set to the exception url, but that also not helping me 
much. Even though the url set to exception handler, a refresh on that still 
shows struts 500 error.

Thanks for all help guys..
-Denny


  


-----Original Message-----
From: Wes Wannemacher [mailto:w...@wantii.com] 
Sent: Friday, September 11, 2009 1:32 PM
To: Struts Users Mailing List
Subject: Re: excpetion chaining to custom exception handler issue

Your exception mapping is likely throwing an exception then... think
of it like this -

1 Action gets invoked
2  Oh-No! an exception -> go to the exception page
3 Exception page invoked
4  Oh-No! an exception -> go to #2

Xwork's chain result explicitly checks that an infinite chain sequence
isn't happening. That's more or less the only thing the chain result
checks, so I would make sure this isn't the case.

-Wes

On Fri, Sep 11, 2009 at 1:23 PM, Denny Erinjery
<denny.erinj...@timelink.com> wrote:
> Anybody have any ides about this??
> I try to do an additional action class with  redirectAction after the
> first chaining using a second action to avoid the 500 error but that
> didn't help me, debugging into the ActionChain interceptor from xworks
> shows that it went to an infinte error  after checking the
> chaininghistory
> Thanks
>
>
> -----Original Message-----
> From: Denny Erinjery [mailto:denny.erinj...@timelink.com]
> Sent: Thursday, September 10, 2009 3:04 PM
> To: Struts Users Mailing List
> Subject: excpetion chaining to custom exception handler issue
>
> HI,
> I'm using a global exception handler action class to get the exception
> details and display it on a custom error page.
> Following is the struts xml configuration
>        <global-results>
>                        <result name="Excpetion" type="chain">
>                                <param
> name="actionName">UnhandledExceptionHandler</param>
>                                <!-- param
> name="namespace">/namespaceWhereActionIsDefined</param -->
>                        </result>
>        </global-results>
>
>        <global-exception-mappings>
>            <exception-mapping exception=3D"java.lang.Exception"
> result="Excpetion"/>
>        </global-exception-mappings>
>
>
>        <action name="UnhandledExceptionHandler"
> class="com.timelink.falco.wui.struts.handlers.GlobalException">
>                    <result name=3D"error"
> type="dispatcher">/jsp/systemerror.jsp</result>
>
>        </action>
>
> Once my action class is invoked it will create my exception object using
> the current exception set by the struts setter as well as I get more
> details about the system at the time of the exception. In order to get
> the exception forwarded to my action class from the action where the
> exception occurs I use chaining in the result mapping
>        "<global-results>
>                        <result name="Excpetion" type="chain"> .... "
> This works and everything is populated on my error jsp page and the page
> gets displayed as expected. Now if I refresh this error page, although
> the actions go through the last exception path as expected, and my error
> handler class is executed, it will not display the error page again this
> time but will end up showing the following error=
>
> HTTP Status 500 - Infinite recursion detected: [//loginAction!login,
> //UnhandledExceptionHandler, //UnhandledExceptionHandler,
> //UnhandledExceptionHandler] - [unknown location]
> com.opensymphony.xwork2.ActionChainResult.execute(ActionChainResult.java
> :203)
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
> ionInvocation.java:361)
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
> cation.java:265)
> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java
> :52)
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:4
> 68)
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher
> .java:395)
>
> After this error if I refresh the above page(HTTP Status 500) , it will
> once again show my error page and a refresh on that page will bring back
> the error 500 again!!! This keeps on doing on consecutive refresh. This
> will go away if I use "redierctAction" in place of "chain" but then I
> will lost the information about the exception once it reached in my
> exception handling action class Please tell me is this a problem on my
> error handling or a sturts issue.
>
> Thanks
> Denny
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Wes Wannemacher

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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to