Home > Software engineering >  Tomcat 9 Startup Order on Centos 7
Tomcat 9 Startup Order on Centos 7

Time:03-24

I have five webapps which are starting at localhost:8080.

  • l.war
  • g.war
  • w.war
  • e.war
  • r.war

All WAR files store in tomcat/webapps folder. I'm trying to change startup order like above because G app depends on L app. As I read tomcat starts up with alphabetical order and tomcat doesn't provide any sort of order. Some people could handle this with $CATALINA_BASE/conf/server.xml but They just do this for one application. I didn't see multiple context. So I tried;

  1. Created context xmls in $CATALINA_BASE/conf/Catalina/localhost/ with the naming "l.xml, g.xml, w.xml, e.xml, r.xml".
  2. Then I added below lines to $CATALINA_BASE/conf/server.xml

Content;

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <Context path="$CATALINA_BASE/webapps/l" docBase="$CATALINA_BASE/webapps/l.war"/>
    <Context path="$CATALINA_BASE/webapps/g" docBase="$CATALINA_BASE/webapps/g.war"/>
    <Context path="$CATALINA_BASE/webapps/w" docBase="$CATALINA_BASE/webapps/w.war"/>
    <Context path="$CATALINA_BASE/webapps/e" docBase="$CATALINA_BASE/webapps/e.war"/>
    <Context path="$CATALINA_BASE/webapps/r" docBase="$CATALINA_BASE/webapps/r.war"/>

I used absolute paths instead of $CATALINA_BASE. This caused some kind of recursive startup. How can i change the startup order of applications(without change their names)?

CodePudding user response:

Tomcat comitter here, not possible. Tomcat does not guarantee any startup order. You will need to modify the default component for this.

  • Related