Search code examples
jakarta-eewarwebsphere-libertyear

How to force WebSphere Liberty to start WARs in certain order


Do you know how to force WebSphere Liberty to start WARs (deployed separetly or within single EAR file) in given order. By default WLP is starting it in parallel and there is no information how to tweak it up.

I know that in full WebSphere Application server there was/is such option to define starting weight in deployment.xml but in WLP it seems to be missing.


Solution

  • At the moment, there is no out-of-the-box way to control application start order in Liberty.

    A few alternate options may be:

    1) Use 1 app per server

    Split apart the server so you only have 1 app per server, then use a container orchestration layer to mandate an ordering at the server level.

    2) Use dropins + shell script

    Use the ${server.config.dir}/dropins/ folder and move applications into that folder in a controlled order using scripting. For example:

    mv firstApp.war /path/to/server/dropins/
    # wait some amount of time as a heuristic
    sleep 5
    mv nextApp.war /path/to/server/dropins/
    

    3) Use autoStart=false and start with ApplicationMBean

    If you set <application autoStart="false"> on your applications, you can control the start ordering by invoking ApplicationMBean.start() via JMX. See the ApplicationMBean doc as well as Working with JMX MBeans on Liberty.


    This request has come up a few times though, so we've opened this github issue to discuss a built-in solution.