ServletContextListener notified of unrelated wars deploy actions
posted 3 years ago
This may be JBoss specific (JB v4.2.1.GA) as the container can implement ServletContextListener as it chooses based on my understanding.
I have two war files each with their own ServletContextListener implementation and each implementing contextInitialized() and contextDestroyed(). I start the container with FIRST.war deployed and see contextInitialized() is notified. I then hotdeploy SECOND.war and his listeners contextInitialized() is notified. However, based on the SECOND.war being deployed to the container, the FIRST.war listener fires its contextDestroyed() and then its contextInitialized() methods.
This seems like strange behavior that the war deploy actions bleed across to unrelated wars. Is my understanding of these methods flawed?