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.
This is now possible in Liberty as of version 20.0.0.4 (though it will be in beta until at least 20.0.0.6).
To start "app1" before "app2", you would specify the "startAfter" attribute on "app2".
<application id="app1" location="start_me_first.war"/>
<application id="app2" location="start_me_later.war" startAfter="app1"/>
The startAfter attribute takes a list of application IDs, so you can specify more than one application that must be started before that application can start.
At the moment, there is no out-of-the-box way to control application start order in Liberty.
A few alternate options may be:
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.
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/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With