Multiple virtual servers and ServletContextListener?This information relates to the question posed in this thread regarding multiple virtual servers and webapps – Does a webapp need to be attached to only one virtual server? Yes, ServletContextListener#contextInitialized is called once per virtual server on which the webapp has been deployed. This is because internally, the container creates one servlet context per virtual server on which your webapp has been deployed. In order to deploy your webapp to a subset of available virtual servers, use the --virtualservers virtual_servers option of the asadmin deploy command. Each ServletContext has its own session manager that manages the context's session state. If your webapp has been deployed to multiple virtual servers, a request to your webapp will be mapped to a specific context instance based on the host name in the request. Each context has its own classloader. |