https://issues.apache.org/bugzilla/show_bug.cgi?id=56321

            Bug ID: 56321
           Summary: ServletContextListener.contextDestroyed not completely
                    executed when updating war
           Product: Tomcat 7
           Version: 7.0.52
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: marco.lapon...@kewill.com

When the contextDestroyed accesses a static method on a class which has not
been loaded yet, the rest of the contextDestroyed code is not executed,e.g.,:

package contexttest;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class ContextTest implements ServletContextListener {

    public void contextDestroyed(ServletContextEvent arg0) {
        System.out.println("Context Destroyed");
        MyTest.testStatic();
        System.out.println("Context Destroyed Done");

    }

    public void contextInitialized(ServletContextEvent arg0) {
        System.out.println("Context Initialized");
    }

}

package contexttest;

public class MyTest {

    public static void testStatic(){
        System.out.println("My static method call");
    }
}

When I created a war based on this code, and copy this war to the tomcat web
apps directory, it logs 'Context Initialized' as expected.

When I remove the war it logs:
Context Destroyed
My static method call
Context Destroyed Done

as expected. However when I copy the war to web apps, wait till it is
initialized, and then touch the war (to simulate the update of a the war). It
logs for the destroy event only:

'Context Destroyed'

So the static method call and the 'Context Destroyed Done' is missing. 

When I execute the above on tomcat 7.0.42 it behaves as I would expect, so no
difference between removing a war or updating the war.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to