Why is contextInitialized() called multiple times?

There will be only one ServletContext for each web application. ServletContext will be created while deploying the application (3 Virtual Hosts means deploying to 3 different hosts with 3 different IP addresses). Once the ServletContext is created, it will be used by all the servlets and JSP files in the same application. ServletContext is also called as the application scope variables in the web application scenario.

Source - http://www.javabeat.net/2009/02/servletcontextlistener-example/


Ok I figured it out. It was being called 3 times because I had 3 virtual hosts defined in my jboss-web.xml. Not sure why it causes that behavior though. If anyone can explain the reason I would appreciate it.