Issue
I know that Tomcat and the Servlet spec do not support starting webapps in a particular order.
However, this seems to me like a common use case, and I'm wondering if someone has discovered a clever workaround for it.
I have webapp A which uses Spring Remoting to expose a shared service, of which webapp B is a client. Webapp B cannot initialize unless webapp A is running. However, my Tomcat is always starting the webapps linearly, starting with webapp B.
For infrastructure reasons I have to have these running on the same Tomcat server.
Any ideas?
Thanks, Roy
UPDATE -
Turns out that in my particular case, order doesn't matter. The reason is this: say I use one of the methods below to start app A before app B. So app A starts, but, since Spring remoting is using the HTTP Invoker, the HTTP port is not yet open (it won't open until all apps are started). So A will start, and B will hang, because the port it's looking for is not yet available. Doh.
End result was two separate Tomcat instances.
Solution
We have the same problem and to solve it we're relying on the fact (slippery, I know) that applications are started in the order they are defined in <tomcat_home>/conf/server.xml
.
This of course has a disadvantage of hardcoding apps in the server.xml
but we can live with it.
Answered By - mindas