Re: question about load-on-startup in web.xml
On Wed, May 11, 2005 at 08:53:43PM -0500, Caldarale, Charles R wrote: : > any one know if there's a way to make webappY get installed before : > webappX? : : If you want to synchronize application deployment, I think you're going : to have to do that within the app itself, possibly with context : listeners to minimize inter-app dependencies. What about separating each app into its own Tomcat instance (see the docs on CATALINA_BASE vs CATALINA_HOST)? You could then have a single master script that starts them in the order you require? -QM -- software -- http://www.brandxdev.net/ tech news -- http://www.RoarNetworX.com/ code scan -- http://www.JxRef.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: question about load-on-startup in web.xml
If I were doing it I would put a singleton class in the /common/lib/ that had a Hashtable and in my application's startup I would get the singleton and have the first application I want to load put a string "loading" (or whatever) in the Hashtable of the singleton with the key "webappY". The second webappX get the singleton and look for "webappY"/"loading". If it is still there sleep and check again later. When webappY is finished starting it removes the 'loading' from the Hashtable of the singleton and when "webappX" sees it is gone, it continues. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED] -Original Message- From: Annie Wang [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 11, 2005 3:47 PM To: Parsons Technical Services; Tomcat Users List Subject: Re: question about load-on-startup in web.xml i tried putting in a sleep in my servlet's init method, but $CATALINA_HOME/logs/catalina.out seems to indicate that tomcat waits for it to initalize.. in my catalina.out, i have: May 11, 2005 2:12:06 PM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /webappX from URL file:/jakarta-tomcat/webapps/webappX ***webappX***start init ***webappX***end init May 11, 2005 2:12:06 PM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /webappY from URL file:/jakarta-tomcat/webapps/webappY any one know if there's a way to make webappY get installed before webappX? what determines the install order? i thought it was load-on-startup in the web.xml file, but maybe that affects the ordering of servlet initalization within a web application (if the web application has multiple servlets), but not the ordering of web application installation on tomcat startup. thanks. -annie On 5/10/05, Annie Wang <[EMAIL PROTECTED]> wrote: > hi doug, yup, was thinking along similar lines. just wasn't sure if > there was some setting i wasn't aware of to do what i'm looking for. > > thanks. > -annie > > On 5/10/05, Parsons Technical Services <[EMAIL PROTECTED]> wrote: > > I may be off base on this one but I think that once Tomcat fires off the > > init method it doesn't care or monitor the progress of the servlet. Just > > think, some servlets may take several minutes to finish. If other apps had > > to wait then it could take a long time to get the server started. > > > > Now as for a solution I am really speculating here (hopefully someone can > > educate both of us). I would look at a wait statement in the init method to > > pause the second app's servlet until the first one is done. Simply time the > > first app's servlet and set it for a little more. > > > > Hopefully someone will set me straight if I am off base here. > > > > Doug > > > > - Original Message - > > From: "Annie Wang" <[EMAIL PROTECTED]> > > To: > > Sent: Tuesday, May 10, 2005 6:59 PM > > Subject: question about load-on-startup in web.xml > > > > hi, > > > > regarding the tag in web.xml: > > > > say i have 2 web apps (webapp1 and webapp2). if i configure webapp1's > > servlet to have 1 and webapp2's > > servlet to have 100, does this mean > > that tomcat will init webapp1's servlet first and once that's done, > > it'll init webapp2's servlet? > > > > basically, i want both web app's servlets to auto initialize on tomcat > > startup, but i want webapp2's servlet to initialze only after > > webapp1's servlet has finished initialization. when i use the above > > load-on-startup settings, webapp2's servlet seems to initialize before > > webapp1's servlet has finished initialization. > > > > thanks. > > -annie > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about load-on-startup in web.xml
thanks for the insights and suggestions chuck! On 5/11/05, Caldarale, Charles R <[EMAIL PROTECTED]> wrote: > > From: Annie Wang [mailto:[EMAIL PROTECTED] > > Subject: Re: question about load-on-startup in web.xml > > > > any one know if there's a way to make webappY get installed before > > webappX? > > As far as I can tell, the intent of the JSP and servlet specs is for web > applications to be independent of both the container and each other. > Since Tomcat is the reference implementation for the spec, the > developers seem to avoid introducing many Tomcat-unique features that > would reduce application portability. The load-on-startup tag is part > of the servlet spec, defined to control instantiation of servlets within > an app, not across apps. > > If you want to synchronize application deployment, I think you're going > to have to do that within the app itself, possibly with context > listeners to minimize inter-app dependencies. You'd probably want to > use reflection to make references to whatever class or object you > synchronize on, otherwise you're going to have problems independently > updating the apps without taking Tomcat down. Another option, of > course, is to extend the existing deployOnStartup mechanism to do what > you want. After all, this is open-source. > > Or maybe there's some neat trick I haven't found yet. > > > what determines the install order? > > These references only partially answer the question: > http://jakarta.apache.org/tomcat/tomcat-5.5-doc/deployer-howto.html#Depl > oying%20on%20Tomcat%20startup > http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Automat > ic%20Application%20Deployment > > My somewhat less than rigorous experimentation seems to indicate that > apps are deployed serially, not in parallel, but I haven't tried to > figure out what determines the order. > > - Chuck > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you > received this in error, please contact the sender and delete the e-mail > and its attachments from all computers. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: question about load-on-startup in web.xml
> From: Annie Wang [mailto:[EMAIL PROTECTED] > Subject: Re: question about load-on-startup in web.xml > > any one know if there's a way to make webappY get installed before > webappX? As far as I can tell, the intent of the JSP and servlet specs is for web applications to be independent of both the container and each other. Since Tomcat is the reference implementation for the spec, the developers seem to avoid introducing many Tomcat-unique features that would reduce application portability. The load-on-startup tag is part of the servlet spec, defined to control instantiation of servlets within an app, not across apps. If you want to synchronize application deployment, I think you're going to have to do that within the app itself, possibly with context listeners to minimize inter-app dependencies. You'd probably want to use reflection to make references to whatever class or object you synchronize on, otherwise you're going to have problems independently updating the apps without taking Tomcat down. Another option, of course, is to extend the existing deployOnStartup mechanism to do what you want. After all, this is open-source. Or maybe there's some neat trick I haven't found yet. > what determines the install order? These references only partially answer the question: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/deployer-howto.html#Depl oying%20on%20Tomcat%20startup http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Automat ic%20Application%20Deployment My somewhat less than rigorous experimentation seems to indicate that apps are deployed serially, not in parallel, but I haven't tried to figure out what determines the order. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about load-on-startup in web.xml
i tried putting in a sleep in my servlet's init method, but $CATALINA_HOME/logs/catalina.out seems to indicate that tomcat waits for it to initalize.. in my catalina.out, i have: May 11, 2005 2:12:06 PM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /webappX from URL file:/jakarta-tomcat/webapps/webappX ***webappX***start init ***webappX***end init May 11, 2005 2:12:06 PM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /webappY from URL file:/jakarta-tomcat/webapps/webappY any one know if there's a way to make webappY get installed before webappX? what determines the install order? i thought it was load-on-startup in the web.xml file, but maybe that affects the ordering of servlet initalization within a web application (if the web application has multiple servlets), but not the ordering of web application installation on tomcat startup. thanks. -annie On 5/10/05, Annie Wang <[EMAIL PROTECTED]> wrote: > hi doug, yup, was thinking along similar lines. just wasn't sure if > there was some setting i wasn't aware of to do what i'm looking for. > > thanks. > -annie > > On 5/10/05, Parsons Technical Services <[EMAIL PROTECTED]> wrote: > > I may be off base on this one but I think that once Tomcat fires off the > > init method it doesn't care or monitor the progress of the servlet. Just > > think, some servlets may take several minutes to finish. If other apps had > > to wait then it could take a long time to get the server started. > > > > Now as for a solution I am really speculating here (hopefully someone can > > educate both of us). I would look at a wait statement in the init method to > > pause the second app's servlet until the first one is done. Simply time the > > first app's servlet and set it for a little more. > > > > Hopefully someone will set me straight if I am off base here. > > > > Doug > > > > - Original Message - > > From: "Annie Wang" <[EMAIL PROTECTED]> > > To: > > Sent: Tuesday, May 10, 2005 6:59 PM > > Subject: question about load-on-startup in web.xml > > > > hi, > > > > regarding the tag in web.xml: > > > > say i have 2 web apps (webapp1 and webapp2). if i configure webapp1's > > servlet to have 1 and webapp2's > > servlet to have 100, does this mean > > that tomcat will init webapp1's servlet first and once that's done, > > it'll init webapp2's servlet? > > > > basically, i want both web app's servlets to auto initialize on tomcat > > startup, but i want webapp2's servlet to initialze only after > > webapp1's servlet has finished initialization. when i use the above > > load-on-startup settings, webapp2's servlet seems to initialize before > > webapp1's servlet has finished initialization. > > > > thanks. > > -annie > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about load-on-startup in web.xml
hi doug, yup, was thinking along similar lines. just wasn't sure if there was some setting i wasn't aware of to do what i'm looking for. thanks. -annie On 5/10/05, Parsons Technical Services <[EMAIL PROTECTED]> wrote: > I may be off base on this one but I think that once Tomcat fires off the > init method it doesn't care or monitor the progress of the servlet. Just > think, some servlets may take several minutes to finish. If other apps had > to wait then it could take a long time to get the server started. > > Now as for a solution I am really speculating here (hopefully someone can > educate both of us). I would look at a wait statement in the init method to > pause the second app's servlet until the first one is done. Simply time the > first app's servlet and set it for a little more. > > Hopefully someone will set me straight if I am off base here. > > Doug > > - Original Message - > From: "Annie Wang" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, May 10, 2005 6:59 PM > Subject: question about load-on-startup in web.xml > > hi, > > regarding the tag in web.xml: > > say i have 2 web apps (webapp1 and webapp2). if i configure webapp1's > servlet to have 1 and webapp2's > servlet to have 100, does this mean > that tomcat will init webapp1's servlet first and once that's done, > it'll init webapp2's servlet? > > basically, i want both web app's servlets to auto initialize on tomcat > startup, but i want webapp2's servlet to initialze only after > webapp1's servlet has finished initialization. when i use the above > load-on-startup settings, webapp2's servlet seems to initialize before > webapp1's servlet has finished initialization. > > thanks. > -annie > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about load-on-startup in web.xml
I may be off base on this one but I think that once Tomcat fires off the init method it doesn't care or monitor the progress of the servlet. Just think, some servlets may take several minutes to finish. If other apps had to wait then it could take a long time to get the server started. Now as for a solution I am really speculating here (hopefully someone can educate both of us). I would look at a wait statement in the init method to pause the second app's servlet until the first one is done. Simply time the first app's servlet and set it for a little more. Hopefully someone will set me straight if I am off base here. Doug - Original Message - From: "Annie Wang" <[EMAIL PROTECTED]> To: Sent: Tuesday, May 10, 2005 6:59 PM Subject: question about load-on-startup in web.xml hi, regarding the tag in web.xml: say i have 2 web apps (webapp1 and webapp2). if i configure webapp1's servlet to have 1 and webapp2's servlet to have 100, does this mean that tomcat will init webapp1's servlet first and once that's done, it'll init webapp2's servlet? basically, i want both web app's servlets to auto initialize on tomcat startup, but i want webapp2's servlet to initialze only after webapp1's servlet has finished initialization. when i use the above load-on-startup settings, webapp2's servlet seems to initialize before webapp1's servlet has finished initialization. thanks. -annie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]