• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in invoking sessionDestroyed(se ) with struts under tomcat5

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm working on a struts based web-application that is deployed on tomcat5.0.27 under Windows OS.I have added a SessionListener class to tarck the session creation & destruction.
The problem is that my SessionListener class's method public void sessionDestroyed(HttpSessionEvent se) is not being called, everytime the session times-out.

I have explicitly set session.setMaxInactiveInterval(20) at my logon page.So, If I do not do any action on a page for more than 20 seconds, the session should be expired and the method public void sessionDestroyed(HttpSessionEvent se) of SessionListener class must be called.It is not happening after I move on to certain pages, but on some other pages it is working.

Could this be Struts or tomcat5.0.27 specific issue?
please help me on this.

Regards.
KuldeepT.
[ March 09, 2007: Message edited by: K Tewari ]
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session management will be handled internally by the servers. We have to set only the length of session expiry based on our requirements.

Is there any specific reason for you to write a new class for session management?

Regards,
Pk
 
Kuldeep Tewari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks PK,
I've to do some manipulation on some objects in Cache, once the logged-in user's session expires.That's why I'm interested in knowing when the session expires.
But the SessionListener's sessionDestroyed() method is being called by the container only when I'm on certain pages, on others its not being called even after the timeout period elapses on that particular page.
I just want to know if there is some issue with how & when this callback method is called by the container while running a struts based application.

Regards.
Kuldeep.
[ March 09, 2007: Message edited by: K Tewari ]
 
Periakaruppan Thiagarajan
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okies...

Can you confirm me how the URL pattern is configured in web.xml for this listner?

Does the URL pattern includes the pages for which you are facing the problem?

Regards,
Pk
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I know what your "random" problem is about. In some pages you may have an action with session ActionForm, and in these pages your listener is invoked if the session is expired. But in the ones with request ActionForm (or some of them) it's not done. This is due to in the pages that don't get this event thriggered you are not accessing the session object, that's it, there is no request.getSession(), so the session is not checked of its existence and validity. In the cases you have session ActionForms, this call is made by Struts in order to get the session to retrieve and store your form, but it's not the same case when the ActionForm is request scope.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic