One could envision a rather complex and somewhat funky solution to this... I'm not so sure I'd recommend it, but in the interest of creative thinking...

(1) Add a context parameter isAppRunning to the webapp, initially set to "false".

(2) Create a filter that is mapped to handle all requests. It checks the value of isAppRunning, and redirects to some page if the value is "false".

(3) Create a ContextListener that fires off a daemon thread.

(4) The daemon thread makes a simple request to some predefined URL of the other webapp. If it does not get the response it expects, it sleeps for a second or two and then tries again.

(5) When the daemon thread gets the reply it expects, it sets isAppRunning to "true" and dies.

Now, add this all to the "master" webapp, that is, the one that depends on the other. All requests should be blocked and redirected to the page of your choice until the webapp it depends on returns that OK reply. I could envision this being done with a number of webapps, forming a dependency chain not unlike "depends" in Ant.

Will it work?  I think so, but I just made it up, so who knows :)

Frank

SOA Work wrote:
argh. annoying.
ok. thx anyway.

-----Ursprüngliche Nachricht-----
Von: "Tomcat Users List" <users@tomcat.apache.org>
Gesendet: 24.04.06 17:57:49
An: "Tomcat Users List" <users@tomcat.apache.org>
Betreff: Re: is there a possibility to define the startup order for webapps?


A couple of other ideas:

Use a small shared class (in shared/lib) to keep track of whether the
database is running. The first webapp notifies this class when it's
ready, and the second webapp checks if the database is ready before
using it.

Or, just accept that database errors will occur during startup. This
is not a bad solution. From a user's point of view, when the server is
down all requests will return some kind of error, until the server is
back up and running. The only thing you can hope to gain is a better
error message for a few seconds during startup.
--
Len


On 4/24/06, David Smith <[EMAIL PROTECTED]> wrote:
This question comes up every so often and the answer is always no. The
webapp load order cannot be relied upon. In your case, might I suggest
the database webapp be run on a separate instance of tomcat?  Can the
connection be done via TCP/IP?

 --David

SOA Work wrote:
Hi there,

I'm currenttly using tomcat 5.x for running my webapps. Now I have the 
following problem:

I'm using an database system which runs as webapplication inside tomcat.
Another webapplication needs the database connection for startup.
Everytime I restart tomcat the server doesn't get up, because the second webapp 
ist started before the database webapp.

Is there a way to define the startup order of the webapplications deployed on a 
server?
With wich system does tomcat choose the apps while startup? Could it be a 
possibility to rename the folder of the webapps?

thx
Dominik
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


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



--
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940


---------------------------------------------------------------------
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]



_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


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





--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

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

Reply via email to