Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Problem running same ServletContextListener for multiple contexts


Message #1 by Kent.Lichty@D... on Mon, 24 Jun 2002 15:49:05
I am experiencing a problem that I hope someone can help me with. I have a 
simple web application running on Tomcat 4.0.3 on a Win2K box.  In the 
web.xml file for the context, I have specified a <listener-class> element 
to cause a ServletContextListener program to kick in whenever my web 
context starts up. This program performs a bunch of critical 
initialization stuff; loading the ServletContext with common information, 
etc. Everything works fine if there is only ONE context that uses the 
program.

But now assume that I define more than one web context. That is, my code 
is identical but I want to have one context for production, one context 
for test, etc. The same ServletContextListener program is specified for 
ALL my contexts. Well, when this happens, Tomcat just cant seem to handle 
it. It stays up for a few seconds, and then just dies with no information 
in the logs about what it doesn't like. It is clearly related to using the 
same ServletContextListener program because if I change the web.xml files 
to only have ONE of the contexts use the program then everything works 
fine. 

I can find no documentation about this behaviour and was just wondering if 
anybody else had experienced it. Thanks very much for your help.

  Return to Index