Overview

Deploying multiple instance of Jboss on a single Jboss server.

Requirements

Jboss Installation used  :: 4.2.2.GA

Objective

Run two Jboss instance on same server, on ports 80 and 8080

Configuration

Step1

On the Jboss installation server directory , make a copy of default directory

root@serv:~# cd /usr/local/jboss/server
root@serv:~# cp -rpf default node01

Step 2

Jboss has 3 set of preconfigured ports for running 3 different instance together. The default installation will be using the  ports-default set, we can use ports-01 for our node01.

To use ports-01 uncomment below lines in file /usr/local/jboss/server/node01/conf/jboss-service.xml

root@serv:~# vim /usr/local/jboss/server/node01/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>

Also change serverBindPort from 4446 to 14446 in the same file

root@serv:~# sed -i  “s/4446/14446/g” — /usr/local/jboss/server/node01/conf/jboss-service.xml

Step 3

Change the port from 3873 to 13873  in deploy jboss-service.xml

root@serv:~# sed -i “s/3873/13873/” — /usr/local/jboss/server/node01/deploy/ejb3.deployer/META-INF/jboss-service.xml

Step4

Change the default listening port form the default value ( I had 80 as default ) to a custom value

changing 80 to 8080

root@serv:~# sed -i “s/80/8080/g” — /usr/local/jboss/server/node01/deploy/jboss-web.deployer/server.xml

also change Connector port  from 8019 to 8119

root@serv:~# sed -i “s/8019/8119g” — /usr/local/jboss/server/node01/deploy/jboss-web.deployer/server.xml

Step5

Now, you can run the default instance with

root@serv:~# /usr/local/jboss/bin/run.sh

and the new instance on port 8080 with

root@serv:~# /usr/local/jboss/bin/run.sh -c node01