On Mon, 19 Apr 2004, Brett Randall wrote:

> Can anyone advise - what would cause a listener's
> contextInitialized() to be called exactly twice during the
> deployment of a webapp?
>
> I am using Tomcat included in the Java Web Services Developer Pack
> v1.3.  The double call of contextInitialized() happens for both my
> servlets, and the example servlets that have listeners defined.
>
> The only hint I have at the moment is that when incrementing one
> static and one instance counter within the listener, on both calls
> both variables are 1 (from 0), so could two different classloaders
> or VMs be instantiating the ContextListener, and what would cause
> that?
>
> I don't have any virtual hosts defined.

Sounds like you have two *instances* of your servlet being loaded (so
it's two separate instances of contextInitialized() being invoked).
This can happen if you have two different definitions of the servlet
in your web.xml, and/or perhaps if you have your webapp/context being
loaded twice, like one automatically (because of an attribute setting
like autoDeploy/deployOnStartup) and once because of a Context element
in your server.xml and/or a seperate context configuration file.

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to