File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session already invalidated

 
Dilip kumar
Ranch Hand
Posts: 360
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All -

I'm not able to find out what's causing this error.


type : Exception report

message :

description : The server encountered an internal error () that prevented it from fulfilling this request.

exception :

java.lang.IllegalStateException: getAttribute: Session already invalidated
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:984)
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
Main.doGet(Main.java:60)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)


note : The full stack trace of the root cause is available in the Apache Tomcat/5.5.8 logs.


Am I using the session wrong way ? Really appreciate any suggestions. Thanks

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You problem is that the session is an instance variable, there is only one variable and all of your rerquests end up sharing it. Move it inside the method instead so there will be one per thread instead.

Dave
 
Dilip kumar
Ranch Hand
Posts: 360
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave, Thanks for the responese.

I'm little bit puzzled about sessions. I would like to set some default values to session variables when the user first time comes to the web page via servlet. Later the values for session variables chaanges based on user selecting differing parameters. If I move HttpSession session; inside the
goGet how I do I know whether it is new seesion of existing session.

Thanks again.
 
Dilip kumar
Ranch Hand
Posts: 360
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will try

HttpSession session = req.getSession(true);

if (session.isNew()) {

} else {

}

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic