• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Listener not getting invoked

 
Krishna Sri Divi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic