0 Replies Latest reply on Oct 9, 2018 5:20 AM by Adrien T

    Applications order of (re)deployment

    Adrien T Newbie

      Hi all,

       

      This topic is often discussed but usually failed to be addressed properly.

       

      I have a set of EARs and WARs applications on my Wildfly 10.1. Those ones are dependent between each others.

       

      For example, ear1 depends on ear2 and I can have ear3 depending on ear1 so we end up with things like ear3 -> ear1 -> ear2. Same goes with WARs so it can even be war1 -> ear3 -> ear1 -> ear2.

       

      So far I never tried to explicitly define dependencies between my applications. It works well when I do the first deployment on the server because I control the order ; I simply run the deployment commands sequentially like:

      1. deploy ear2
      2. deploy ear1
      3. deploy ear3
      4. deploy war1

       

      My problem is when the server is restarted: the order is random and my apps are deployed in parallel. And every now and again I have one app failing to start because the context initialisation can't find a given EJB. For example, using the above config, ear3 will be deployed before all EJBs in ear2 are deployed and an EJB lookup will fail within ear3.

       

      So I started to look at defining my dependencies via a jboss-all.xml file with jboss-deployment-dependencies / dependency. For example I have

      • ear1 defining ear2 as a dependency
      • ear3 defining ear1 as a dependency
      • war2 defining ear3 as a dependency

       

      With that being set the restart of Wildfly still is deploying apps in a random order. Even worst, if I undeploy one app like ear1 all the apps are disabled and the entire server is unusable (even after re-reploying ear1). The later may sound expected but sometimes I need to replace an ear and I expect independent services, ie that are not depending on other EARs, to still be usable. So adding explicit dependencies between my ears is not addressing my initial problem and is even adding constraints I don't want.

       

      Is it something anyone managed to solve properly? Ie being able to guarantee the order of deployment on Wildfly boot without automatically disabling all apps if redeploying a single EAR during runtime.

       

      Many thanks