You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/01/28 17:09:22 UTC

DO NOT REPLY [Bug 26496] New: - Session listeners are not notified when webapp redeployed/stopped (or server is shut down)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26496>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26496

Session listeners are not notified when webapp redeployed/stopped (or server is shut down)

           Summary: Session listeners are not notified when webapp
                    redeployed/stopped (or server is shut down)
           Product: Tomcat 5
           Version: 5.0.16
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: vspa@mail.ru


If I have an HttpSessionListener implementation defined in web.xml, or I have an attributes in 
session which implement HttpSessionBindingListener, neither one gets notified when I 
redeploy war file via manager (ant task) nor if I stop/remove it via manager's web interface. Also 
those events are not fired if I stop tomcat.

In code below "SESSION TERMINATED" never gets 
printed when you close tomcat or redeploy/remove/stop webapplication via manager.

I 
believe, it should happen. That is, session must be invalidated by container upon destroyng 
webapplication. 

For instance, in my case, we need to notify a legacy system, that our user 
finished his work, we can't force him to click on "Log out" button, so we must track session 
expiration. It all works fine (natural expiration by timeout), but when I redeploy new version of 
our webapp via ant task, existing sessions are not terminated properly.

=== Test code 
===
package test;

import javax.servlet.http.HttpSessionBindingEvent;
import 
javax.servlet.http.HttpSessionBindingListener;
import 
javax.servlet.http.HttpSessionEvent;
import 
javax.servlet.http.HttpSessionListener;

public class MySessionListener implements 
HttpSessionListener {

	public void sessionCreated(HttpSessionEvent _aArg0) 
{
		System.out.println("SESSION CREATED");
		
	}

	public void 
sessionDestroyed(HttpSessionEvent _aArg0) {
		System.out.println("SESSION 
TERMINATED");
	}
}

=== goes to web.xml ===
<listener>
 <listener-
class>test.MySessionListener</listener-class>
</listener>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org