title: Tomcat - starting webapps in a specific order
body: <p>I know that Tomcat and the Servlet spec <a href="https://stackoverflow.com/questions/1504098/start-webapps-in-tomcat-in-a-determinate-order">do not support starting webapps in a particular order</a>.</p>
  
  <p>However, this seems to me like a common use case, and I'm wondering if someone has discovered a clever workaround for it.</p>
  
  <p>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.</p>
  
  <p>For infrastructure reasons I have to have these running on the same Tomcat server.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks,
  Roy</p>
  
  <p><strong>UPDATE</strong> -</p>
  
  <p>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 <em>all</em> apps are started).  So A will start, and B will hang, because the port it's looking for is not yet available.  Doh.</p>
  
  <p>End result was two separate Tomcat instances.</p>