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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…