Chris, I can assure you that this is not a Tomcat issue. Let's try to take
it off-list from here. I have attached some code inline to this post which
will hopefully address, if not fix, your problem. See below:

----- Original Message -----
From: "Chris Wilson" <[EMAIL PROTECTED]>

> Sure that makes sense, that's what I understood was happening...  I
> don't think that's the problem though.  I fully expect the session to be
> invalid.
>

But remember that if you call session.invalidate() on an already invalidated
session, it throws an IllegalStateException, which is symptomatic of the
problem you described. As a matter of fact, the session object is null after
being invalidated, whether programmatically or by the servlet container, so
getting any properties from a null object will return unexpected results.
:)


> I assume that you would do that with the
> following code...
>
> if((System.currentTimeMillis() - session.getLastAccessedTime())
>   > session.getMaxInactiveInterval()) {
>   // session timed out
> }

Actually, I believe the correct convention here would be to use
getMaxInactiveInterval() when the session is valid, so that it's still
*legal* to get attributes from the session. Ideally, you would do this in
the valueUnbound() method of your listener class. I'm nearly positive that
this is occurring through a getAttribute() call in the ServletContext class
of the servlet container (which also throws IllegalStateException). After
the servlet container invalidates the session, all future references to the
session object will evaluate to null, thus causing the exception that you're
getting. Note that running this code snippet on WebSphere and JRun produced
a similar result as Tomcat. It's just plain not a server issue.

This statement would get you the same net effect as what you're describing
above:
if(session == null)
{
    //handle session timeout
}

I'm happy to help you off-list if needs be. Email me at [EMAIL PROTECTED]
scott



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to