At my office we run JBoss 4.0 and use Eclipse to debug and run the JBoss server. We're deploying simple wars, nothing terribly complex. However, I haven't yet figured out how to get this version of JBoss to either allow me to run separate instances of the war (HEAD and the Branch, for example) or to run separate servers controlled by two different projects in Eclipse. Anyone know how to do this? I've searched and found nothing that addresses this specifically.
views:
93answers:
3I think you can subscribe various instances of JBoss to your eclipse installation. normal installation example
Hope it helps you
You just need to run JBoss using two different server configurations. So, you'd drop one WAR into server/default/deploy
and the other into (for example) server/alternate/deploy
.
The difficulty here, particularly with JBoss 4, is getting one of the configurations to use different ports. It mostly involves manually editing port number in a variety of config files for your secondary configuration. I can't find my reference (haven't used JBoss 4 in a while) but these steps worked for JBoss 4.2.2 when last I tried. Copypasta from that link:
Many of you requested steps for current release of JBoss 4.2.2 GA, here it goes:
- deploy/jboss-web.deployer/server.xml
- change 8080 to 18080
- change 8443 to 18443
- change 8009 to 18009
- deploy/http-invoker.sar/META-INF/jboss-service.xml
- change 8080 to 18080
- deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml
- change 8080 to 18080
- change 8443 to 18443
- deploy/ejb3.deployer/META-INF/jboss-service.xml
- change 3873 to 13873
- deploy/jms/uil2-service.xml
- change 8093 to 18093
- conf/jboss-service.xml
- change 8083 to 18083
- conf/jboss-minimal.xml
- change 1099 to 11099
- change 1098 to 11098
- conf/jboss-service.xml
- change 1099 to 11099
- change 1098 to 11098
- change 4444 to 14444
- change 4445 to 14445
- change 4446 to 14446
There can be many entries of these port numbers in these files. Make sure you change all of them.
Alternately, you could just run your two WARs under the same JBoss config (e.g. drop both WARs into server/default/deploy
) but they need to at least have different context roots.
The three things you have to think about are:
- Making sure that instances do not overwrite each other’s files
- Making sure that the instances don’t open the same TCP ports
- Determining how to shut down each instance
Create a copy of your configuration so you don't have file collisions (like when temp files are created). Then, I would recommend just binding the two configurations to different IPs on the same machine, which will avoid port conflicts. You can do something like this:
run –b 192.168.0.100 –c myconfig
run –b 192.168.0.101 –c myconfig2
If you have two network cards, this is easy. If you don't, you can setup virtual IP addresses with a loopback adapter on Windows. On Linux, you can use ifconfig.
To shut down, just make sure you specify the IP/port to shut down, like this:
shutdown –s 192.168.0.100:1099 -S
shutdown –s 192.168.0.101:1099 -S
I'm not sure how to get you going on Eclipse, but you should be able to specify those flags to the run and shutdown scripts through the configuration somehow.
We cover this topic in depth in JBoss in Action in section 15.2 - Collocating multiple application server instances.