Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session cleared after first access

 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSF 2.0 with JBoss AS 7. I am attempting to use a session to store some user related information, but the session is somehow being cleared after the first access of the session.

When accessing the session, I use the following contained in the Post Construct of a Session Scoped bean:



When a fresh user navigates to the site the session is null as expected. As a result they are prompted to enter in some information which creates a new session, also contained in a Session Scoped bean, as follows:



The user is then redirected to the outcome page and the session map is accessed as above, this time the session is not null as expected and contains the data as entered. When the user navigates to any other page the session again is null when attempting to access it, even though the JSESSIONID is the same in both cases.

Thanks for any advice on this issue.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you will get better responses from our JSF forum. Am moving this post there.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's better to simply inject objects when using JSF instead of doing explicit object location in code.

Nevertheless, you did a session.invalidate() right before you attempted to get the session.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, thank you for your response. You were right I did call the invalidate method, although not the one that I had posted. Anyway you lead me down the path to finding the issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic