Running two JBoss domains on same host
There may be times when you want to run two domains/instances of JBoss servers on the same host (say your local machine). Each service of JBoss uses a separate port for its functioning. For example the HTTP server listens on port 8080, JNDI service listens on 1099, etc. So, to run two instances of JBoss server on the same machine, you need to edit configuration files of these services such that both instances do not use the same port for the same service. For example, by default JNDI service on both instances use 1099 port. Hence, the second instance will not start up with out changing this port number.
Now, how do you identify all the ports which are used by JBoss. Run JBoss” default configuration. After the server is started, issue the command netstat —ano. This command lists all used ports and the process ids (PID) of processes using these ports. Look for well known JBoss port, 8080 and note the respective PID. Now look for JBoss” pid under PID column (you will find more than one) and note all the port numbers. These are all the ports which are used by JBoss” services.
Now, search for these port numbers, through all .xml files in JBoss” default domain folder. When I ran the search on default domain of jboss 4.2.0, below are the list of file I had to change:
conf\jboss-minimal.xml line number 82 for port 1098
conf\ jboss-service.xml line number 257 for port 1099
conf\jboss-minimal.xml line number 76 for port 1099
conf\jboss-service.xml line number 251 for port 1099
deploy\ejb3.deployer\META-INF\jboss-service.xml line number 12 for port 3873
conf\jboss-service.xml line number 426 for port 4444
conf\jboss-service.xml line number 450 for port 4445
conf\jboss-service.xml line number 510 for port 4446
deploy\jboss-web.deployer\server.xml line number 39 for port 8009
deploy\jboss-web.deployer\server.xml line number 22 for port 8080
conf\jboss-service.xml line number 210 for port 8083
deploy\jms\uil2-service.xml line number 22 for port 8093
You may change port numbers in above listed files, as desired.