views:

93

answers:

3

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.

A: 

I think you can subscribe various instances of JBoss to your eclipse installation. normal installation example

Hope it helps you

SDReyes
A: 

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.

Matt Ball
I tried simply assuming it could handle different context roots. Since I'm basically just deploying a HEAD and branch version of the same site I deployed two wars. oursite.war and oursite-trunk.war. It didn't work right. In part because when you deploy it through Eclipse eclipse needs to debug against source control. So it expects oursite-trunk.war to exist in the dist directory. So trying this didn't work. I wish something this simple did.
Preston Crawford
+1  A: 

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.

Javid Jamae
I tried this right here and I now have two distinct environments setup. There is a hitch, though. The hitch being that I can't start them both at once. I'm using the same JBoss instance. I assumed this would work, but I wasn't sure how Eclipse handled it. But basically if I try to have both running the second one to start complains about port 8080 being locked even though they're configured under 2 completely different IP addresses.
Preston Crawford
The one variation I did on this is that I didn't need both running at the same exact time. At least not yet. But I was floundering thinking I had to use separate instances of JBoss. This cleared things up. Thanks.
Preston Crawford