File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes java.lang.IllegalStateException: invalidate: Session already invalidated Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "java.lang.IllegalStateException: invalidate: Session already invalidated" Watch "java.lang.IllegalStateException: invalidate: Session already invalidated" New topic
Author

java.lang.IllegalStateException: invalidate: Session already invalidated

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 672
Hello,

I am getting following error:


I am opening two sessions at a time

but before this newSession I already have opened session as following:

this session is closed at the end when all tasks are done that throws the aforementioned stackTrace. I stuck that using newSession.invlidate() why session instance is also invalidating?

Thanks in anticipation
Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 89

req.getSession(true) does not create a new session. It will create a new session only if there is no existing session. So in your case when you do req.getSession(true) it will return a reference to the same session you had before. If you invalidate that session and then try to do stuff with the same session, it wont work. It might be a different reference to the session, but still it is pointing the session that was just invalidated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.IllegalStateException: invalidate: Session already invalidated
 
Similar Threads
Tomcat Server Error: java.lang.NoSuchMethodError
Servlet crash every morning, was working ok before I went to sleep
Session already invalidated
a application responds very slow
how to proof, if Session is invalidate()