• 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

Session Listener not getting invoked

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm new to servlets and JSPs. I created a test session listener (source from rose india).
Listener code
--------------


Servlet
-------


web.xml
---------


I deployed this app in tomcat web server. According to my understanding i should able to see the print statements in listener class either in console or logs when it gets invoked. Please correct me if i'm wrong. I could see only servlet print statements on console but not listener's. Any enlightenment is much helpful.
Regards,
Krishna sri.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Krishna,
I'm surprised Tomcat doesn't give you and error about bad web.xml. It should be:



You were missing an "e" in listener.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:You were missing an "e" in listener.



excellent Jeanne
 
Krishna Sri Divi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much Jeanne! Very nice catch. . Surprisingly this error was not visible in logs and application was not running as expected.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you actually seeing those attributes when the sessionDestroyed method is called?

I have been under the impression that you can't rely on session contents still being there when sessionDestroyed is called.

Bill
PS: AHA - I get to answer my own question. Prior to servlet API 2.4 the state was undefined. API 2.3 definitively states that sessionDestroyed is called before the session is invalidated. I think I got bit by this years ago with an early Tomcat version.
 
reply
    Bookmark Topic Watch Topic
  • New Topic