Search code examples
javajboss7.xear

How to run 2 ear files on jboss 7 with different configurations


I have a Jboss 7.1.1 installation and I want to deploy 2 EAR files on it, each one runs in a different instance with different standalone.xml configuration, what will be the best way to do it ?

What i thought of is to define 2 different deployment definitions for the 2 apps, which means to change this section:

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
        <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>
    </subsystem>

Is that the way to go or is there a better way?


Solution

  • You can specify a deployment scanner that uses a property, say "my.deploy.dir" and specify that when starting each instance of your standalone server.

    <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
        <deployment-scanner name="myDeployDir" path="${my.deploy.dir}" />
    </subsystem>
    

    You will specify the value for the property during startup using a property file or with a -D.

    bin/standalone.sh -P propFile_that_has_my.deploy.dir_value
    
    bin/standalone.sh -Dmy.deploy.dir=myDeployDir1
    

    You can also define another configuration file like your original post.