Is there a way to enforce a deployment order in tomcat6?

后端 未结 7 1808
灰色年华
灰色年华 2020-12-01 16:37

I have 3 wars in my webapp folder. Two of them are built on services of the third one. I\'m in a testing environment, i.e. I don\'t have control over their architectures, so

7条回答
  •  悲&欢浪女
    2020-12-01 17:06

    That's quite easy to achieve if you don't care hacking a bit of tomcat code and creating your own Host instance

    1) Create a subClass of org.apache.catalina.core.StandardHost, say MyHost:

    class MyHost extends org.apache.catalina.core.StandardHost{
        public MyHost (){
        super();
        //changing HashMap for a predictable ordered Map :)
        this.children = new LinkedHashMap();
        }
    } 
    

    2) register your class on your server's xml Host tag ()

    Incredible as it may seem, it solves the problem as long as you have all your web app declared in the correct order inside of Host tag:

    
     
     
    

    Thaen app1 will start before app2, no matter which SO you used.

提交回复
热议问题