Reputation: 167
I want to run two deployed applications ( .ear ) in two instances of JBoss 6.0 at the same time
I have changed all used ports of both standalone.xml files including http , management-http , etc...
Like this:
application1.ear : socket-binding name="http" port="8080
application2.ear : socket-binding name="http" port="8081
application1.ear : name="management-http" port="9990
application2.ear : name="management-http" port="9991
Any Help is appreciated
Upvotes: 0
Views: 3342
Reputation: 4309
Following are the two ways to run mutliple JBoss instance on same server.
Bind each instance to a different IP address
This is the easiest and most recommended way to solve this problem. If the server has multiple NICs then this is simple. If not, then one must "multi-home" the server. In other words, assign the server more than one IP address through OS configuration. Start the instances like so:
$JBOSS_HOME1/bin/run.sh -b <ip-addr-1>
$JBOSS_HOME2/bin/run.sh -b <ip-addr-2>
The same $JBOSS_HOME
can be used with multiple "profiles" in $JBOSS_HOME/server. For example:
$JBOSS_HOME/bin/run.sh -b <ip-addr-1> -c node1
$JBOSS_HOME/bin/run.sh -b <ip-addr-2> -c node2
Service Binding Manager
Configure the "Service Binding Manager" to tell the JBoss instances which ports to use.
Uncomment the "jboss.system:service=ServiceBindingManager
" MBean in $JBOSS_HOME/server/$PROFILE/conf/jboss-service.xml
.
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>
This tells JBoss to use the port numbering scheme defined by "ports-01
" in $JBOSS_HOME/docs/examples/binding-manager/sample-bindings.xml
. This scheme increases the second most significant digit of every port by 100. For example, the JNDI port is 1099 by default but 1199 using the ports-01 scheme; the HTTP port is 8080 by default but 8180 using the ports-01 scheme. The sample-bindings.xml
file contains 4 port schemes:
You may want to configure the port set used at start up from the command line or through a system property. If so, adjust the MBean's ServerName to refer to a system property, for example:
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">${jboss.service.binding.set:ports-default}</attribute>
<attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>
Now change it through the following property directly on run.sh/run.bat
or add it to your run.conf options:
-Djboss.service.binding.set=ports-01
If you need more than 4 port sets defined in sample-bindings.xml by default, please refer to the following article for JBOSS 6 EAP:
https://access.redhat.com/site/solutions/237933
Upvotes: 2