Re: contextInitialized called twice during webapp deployment
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]
Re: contextInitialized called twice during webapp deployment
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]
Re: contextInitialized() called twice
Hello Anton, I finally succeeded (I hope !) in finding the cause of my initialization problem. However it is not clear to me whether it is a bug or a feature :) The problem occurs only for a virtual host, the default host behaves as expected. Here is the simplified configuration virtual host paragraph : I define l3sdb as the default (and the only one) web app for this host. In this case the ServletContextListener is initialized twice (a static variable shows that the listener is *created* twice). If I change the context configuration to : the listener is correctly created and initialized only once, but, as a consequence, my application is not anymore the default one. A reasonable workaround would be to add a statement like this : Moreover I've concluded that the appBase should be different for each virtual host even if autoDeploy is false. -- ___ Jean-Paul Le Fèvre * Mail : [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: contextInitialized() called twice
Howdy, Then what do you think "it" depends on? ;) Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Jean-Paul Le Fèvre [mailto:[EMAIL PROTECTED] >Sent: Friday, October 03, 2003 11:35 AM >To: [EMAIL PROTECTED] >Cc: [EMAIL PROTECTED] >Subject: Re: contextInitialized() called twice > > >It does not depend on the detail of the configuration : I have >tested many different approaches. The problem occurs when >there is one default host and one virtual host. > >-- >___ > >Jean-Paul Le Fèvre * Mail : [EMAIL PROTECTED] > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: contextInitialized() called twice
It does not depend on the detail of the configuration : I have tested many different approaches. The problem occurs when there is one default host and one virtual host. -- ___ Jean-Paul Le Fèvre * Mail : [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: contextInitialized() called twice
Howdy, How is your server configured? Specifically, what is the directory structure under webapps, what's in the web.xml for your apps, and what's in server.xml for your contexts/hosts? Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Jean-Paul Le Fèvre [mailto:[EMAIL PROTECTED] >Sent: Friday, October 03, 2003 11:15 AM >To: [EMAIL PROTECTED] >Subject: contextInitialized() called twice > > >My Tomcat configuration defines 3 hosts : it is the same >machine known under 3 different names. Basically there is one context by >host. > >I have a listener for one of my context but this listener is >initialized twice. I do not understand why ! > >Actually the method contextInitialized() is called twice. >I have inserted a couple of println() in contextInitialized() and >contextDestroyed() to see what's going on but this does not give me any >clue. > > > >-- >___ > >Jean-Paul Le Fèvre * Mail : [EMAIL PROTECTED] > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]