• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session lost problem

 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am working on a project where we are storing session in stateful session bean.When the session gets lost depending on the session-timeout property of orion-ejb-jar,i want to open the login page again.Our architecture is much like struts using session bean from action classes.EJB's are deployed on oc4j release 3 presently.When i am trying to redirect the page using request dispatcher, it is giving null pointer exception.I am getting the request dispatcher object but cant invoke any of its method.
PLz help
thanks
candy
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll probably want to post in the EJB forum, don't you think?
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI huey
i have also posted this to ejb forum but didnt got any reply yet
THat why i thought some one from here may answer my questions
THanks
candy
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the EJB forum.
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THanks Morris for moving this to EJB Forum. BUt plz help.
cab anybody answer my question.THanks in advance
candy
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Candy, I think that the problem is we can't quite understand your question. Could you post a little snippet of the code that's failing and post the exception you're receiving? For instance, I can't even figure out if it's failing in your EJB container or in your Web Container from your question...
Kyle
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Kyle
Actually i myself was confused about the problem.Now i am clear.I have a requestActionServlet which instantiate comSession(HttpSErvletREquest req) object and comsession object instantiate comSessionListener object and put this object in request.setAttribute("comsess",comsessionlistener).THis listener object implements sessionBIndingLIstener and hence the method valueBOund and valueUnbound. I want to redirect the user to loging page from valueUNbound method.AS this method gets fired whenever session expires so i am not getting the request object to forward it to login page.
Is it possible to redirect or forward a page from valueUNbound.
Can you give me some solution.
Thanks
candy
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI kyle
I am waiting for your reply.Have u understood my problem.
THanks
candy
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I see the problem. No, it's not possible to do a redirect from valueUnbound because there is no actual HttpRequest in progress when this method may run! The valueUnbound() method may run at any time -- not just during the handling of a request, since sessions expire on a timer. In fact, most of the time the method will run when the user is not making a request of the servlet.
So you need to take a different tack on this. What most people do in this situation is to look to see if there IS an HttpSession for the user at the very beginning of every servlet request (or even in a Servlet filter prior to any servlet running). If the HttpSession is not present (meaning that the session has timed out, or was never created) then you redirect the user to the login page.
Hope this helps.
Kyle
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THanks Kyle
Yes now i am checking the same during request call and followed ur suggestion.ITs working fine.
THanks again.
candy
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad I could help.
Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic