I used to get that exception occasionally for reasons I never quite
understood. Probably different ways of the session ending, by logout or
timeout or server restart... Anyway, I ignored the exception, figuring that
if the invalidation was already done I didn't need to repeat it. I have
this utility method in my Engine:
public void endSession(IRequestCycle cycle)
{
try {
restart(cycle);
}
catch (Exception ex) {
// Ignore it if the session was already invalidated.
log.debug(ex.getMessage());
}
}
I've been running like that for months with no bad effects that I know of.
Hmmm... looking back through my logs, I see that I'm not getting the
exception any more. I must've cleaned up something else since then. Maybe
that will get you started anyway... you can see when the exception is
occurring.
I call that method from a simple form-listener method in my login/logout
component.
----- Original Message -----
From: "LOCHART,DOUGLAS E" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 13, 2005 5:19 PM
Subject: Logout question - Session Already Invalidated
> I implemented the listener approach to logging out as
> reccomended by the FAQ on the Tapestry Wiki. I used this
> approach to give the user an option to continue or to
> cancel out and to do some logging.
>
> Occasionally I have received a ServletException "Session
> Already Invalidated". I found a blurb somewhere on the
> net that mentioned do a restart like this:
>
> public void logout(IRequestCycle cycle)
> {
> IEngineServiceView engine =
> (IEngineServiceView)getEngine();
> engine.restart();
> }
>
> in a listener is bad because the page will still render
> and could cause this exception. However the responder did
> not give a clear alternative as to what to do.
>
> So I again I must ask the Tapestry Gods ..... HELP
>
> What is the best way to handle a logout CLEANLY that
> terminates the session?
>
> Please give an example if its not a simple one.
>
> Thanks again to all,
>
> Doug
>
>
> ---------------------------------------------------------------------
> 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]