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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to