This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes HttpSessionListener in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HttpSessionListener in Tomcat" Watch "HttpSessionListener in Tomcat" New topic

HttpSessionListener in Tomcat

Adrian Enns
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I am using Tomcat 5.5. I created a class that implements HttpSessionListener, but I cannot get any of the events to be raised.

The code for the class is:

package ca.fcc.ObjectiveFour;

import javax.servlet.http.*;

public class MyHttpSessionListener implements HttpSessionListener
public void sessionCreated(HttpSessionEvent anEvent)
System.out.println("MyHttpSessionListener sessionCreated invoked!");

public void sessionDestroyed(HttpSessionEvent anEvent)
System.out.println("MyHttpSessionListener sessionDestroyed invoked!");


In the web.xml I have the listener declared... but no events are raised. Here is how it is declared in the web.xml:


Any idea as to why this won't work?
I agree. Here's the link:
subject: HttpSessionListener in Tomcat
Similar Threads
Session log
To Understand
problem with servlet listeners
Not recieving sessionDestroyed on Browser close
HttpSessionListener in JSF App