3 Replies Latest reply on Feb 14, 2005 12:09 PM by rockhopper

    Deployment Order Issues with multiple EARs

    acxsjones

      I have 3 ears, and I need to have one of them deployed before the others, what is the best way to do this?

        • 1. Re: Deployment Order Issues with multiple EARs
          tesuji

          Unfortunately there isn't any nice solution. But a bit of a hack is provided in conf/jboss-service.xml

          You need to comment out the DeploymentSorter below, and use the PrefixDeploymentSorter commented out just below it, like this.

          <!--
          org.jboss.deployment.DeploymentSorter
          -->
          org.jboss.deployment.scanner.PrefixDeploymentSorter

          Now on deployment you'll have to prefix your ears with numbers:

          001_common.ear
          002_app1.ear
          003_app2.ear
          etc...

          This will ensure common.ear will be deployed before any of the other two (but AFTER any ear without the number prefix)

          Personally I thought this was such an ugly solution that I first refused to use it. Until I had no choice any longer, and it works fine. But it's rather disappointing there isn't a way to put order information in the jboss.xml files, it seems so much more logical.

          Something like:
          common.ear,common.sar,whatever.jar
          to indicate that other archives need deploying first shouldn't have been so hard to make I would have thought.


          • 2. Re: Deployment Order Issues with multiple EARs
            jae77

            you would really be better off revamping how you are doing your deployment packaging so you can break the dependencies entirely.

            the PrefixDeploymentSorter will work, but it can become a pain if you need to keep renaming files if the deployment order changes.

            if you are deploying a bunch of thirdparty libraries together in a single ear, consider dropping them in the "lib" directory or package them inside a sar so they are always deployed first.

            also, since jboss supports "russian-doll" packaging, you could also wrap the ear that needs to be deployed first inside a sar archive, so that it gets deployed before anything else.

            • 3. Re: Deployment Order Issues with multiple EARs

               

              "jae77" wrote:

              also, since jboss supports "russian-doll" packaging, you could also wrap the ear that needs to be deployed first inside a sar archive, so that it gets deployed before anything else.


              Hi all,
              I guess you need a jboss-service.xml file in the .sar archive.
              How does it look like if we want to put an .ear in a .sar?

              Could you post an example of it?

              Thanks.
              Johann