Milt,

Thanks for your reply.

Having investigated further, I was able to eliminate the possibility that two instances of my servlet were being deployed.

Instead, I am now pretty sure that I ran into http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22478 , where Ant Tasks and HTML Manager deployment cause double initialization. When I manually deploy or when the server starts-up with the webapp already deployed, my contextInitialized is only called once.

Bug is now marked as fixed, so I need to upgrade ... :-)

Thanks

Brett Randall

------------------------------------------------------------

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

_________________________________________________________________
Protect your inbox from harmful viruses with new ninemsn Premium. Go to http://ninemsn.com.au/premium/landing.asp?banner=emailtag&referrer=hotmail



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



Reply via email to