You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yogesh Manware <yn...@gmail.com> on 2012/12/28 10:40:13 UTC

java.lang.IllegalStateException

Hello,

I am facing weird problem with Tomcat 6.0.32+ version. have anyone
faced such issue? Is this a real bug in Tomcat? This error is
intermittent and does not occur with Tomcat 6.0.16.

Tomcat version: 6.0.32+

OS: windows 7

*Issue: *java.lang.IllegalStateException: getAttribute: Session already
invalidated

In our web application, when the user logs out, we are invoking
httpSession.invalidate(); and then we are redirecting user to login
page. But many a times httpSession.invalidate() is executed in
concurrent thread. This results into IllegalStateException in later
stages.

Following is the console trace
{code}
1. 14:03:10 DEBUG [ttp-8082-4] Startup   		 - #Session Id:
AEBD73C3F228729C90BFC5498B4481FD
2. 14:03:10 DEBUG [ttp-8082-4] Startup           	 -
#httpSession.invalidate() invoked...
3. 14:03:10 DEBUG [ttp-8082-5] LoginFilter               -
#request.getSession(false).getId(): AEBD73C3F228729C90BFC5498B4481FD
4. 14:03:10 DEBUG [ttp-8082-5] LoginFilter               -
#request.isRequestedSessionIdValid(): true
5. 14:03:10 DEBUG [ttp-8082-1] SessionContextListener    -
#sessionDestroyed(HttpSessionEvent event) exiting...
6. 14:03:10 DEBUG [ttp-8082-1] SessionContextListener    -
#sessionCreated(HttpSessionEvent event)
7. 14:03:10 DEBUG [ttp-8082-1] SessionContextListener    - #Session
Id:  0662CA084CBC71F4A7722E05E909E3CF
8. 14:03:10 DEBUG [ttp-8082-1] SessionContextListener    - #Returning
from sessionCreated(HttpSessionEvent event)
9. 14:03:10 DEBUG [ttp-8082-1] IppAuthenticationProvider -
#IppAuthenticationProvider initialized....
10. 14:03:10 INFO  [Thread-73 ] Parameters               - CARNOT
version: 7.1.0.30-r61111
Nov 29, 2012 2:03:10 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet Persistent Faces Servlet threw exception
java.lang.IllegalStateException: getAttribute: Session already invalidated
	at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1077)
	at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
	at com.icesoft.faces.webapp.http.servlet.ProxyHttpSession.getAttribute(ProxyHttpSession.java:107)
	at com.icesoft.faces.webapp.http.servlet.ServletSessionAttributeMap.getAttribute(ServletSessionAttributeMap.java:48)
        ....
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at <path>.LoginFilter.doFilter(LoginFilter.java:385)
{code}

httpSession.invalidate() is invoked at line 2 but it actually
completes at line 5.

Regards,
Yogesh

Re: java.lang.IllegalStateException

Posted by Mark Thomas <ma...@apache.org>.

Yogesh Manware <yn...@gmail.com> wrote:

>Howard,
>Thanks for the reply.
>I am sorry, I guess I could not point out the exact issue in my earlier
>mail. There are many reasons because of which this exception may occur.
>But
>the only thing I am more curious to know is, when I invoke
>httpsession.invalidate(), sometimes it gets executed in concurrent
>thread
>and later the obvious IllegalStateException occurs. This behavior is
>intermittent. I started seeing this behavior(and error) only when I
>switched to 6.0.32 or later version.
>So, my major concern is why httpsession.invalidate() is executed in
>concurrent thread sometimes?

The only way I am aware that this could happen is if the session is being expired by the background thread at the same time as a request is accessing the session. Using the system property org.apache.catalina.session.StandardSession.ACTIVITY_CHECK should fix this. See the 6.0.x docs for details.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: java.lang.IllegalStateException

Posted by Yogesh Manware <yn...@gmail.com>.
Howard,
Thanks for the reply.
I am sorry, I guess I could not point out the exact issue in my earlier
mail. There are many reasons because of which this exception may occur. But
the only thing I am more curious to know is, when I invoke
httpsession.invalidate(), sometimes it gets executed in concurrent thread
and later the obvious IllegalStateException occurs. This behavior is
intermittent. I started seeing this behavior(and error) only when I
switched to 6.0.32 or later version.
So, my major concern is why httpsession.invalidate() is executed in
concurrent thread sometimes?

Regards,
Yogesh

On Fri, Dec 28, 2012 at 10:48 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

>
> http://lmgtfy.com/?q=stackoverflow+jsf+java.lang.IllegalStateException%3A+getAttribute%3A+Session+already+invalidated
>
> and then I clicked on first search result (below)
>
>
> http://stackoverflow.com/questions/4827035/illegalstateexception-getattribute-session-already-invalidated
>

Re: java.lang.IllegalStateException

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
http://lmgtfy.com/?q=stackoverflow+jsf+java.lang.IllegalStateException%3A+getAttribute%3A+Session+already+invalidated

and then I clicked on first search result (below)

http://stackoverflow.com/questions/4827035/illegalstateexception-getattribute-session-already-invalidated