JBoss version: jboss-4.2.1.GA I need to deploy web apps on distinct ports, say webApp1 on 8080, and webApp2 on 8180, and webApp1 cannot be accessed through 8180, and webApp2 not through 8180. Could anybody give some hints?
We are glad to have you here. We have a naming policy at JavaRanch. Your displayed name must consist of a first name (or an initial), a space, and a family name (in that order) and not be obviously fictitious. Please take a moment to change it, which you can do right here.
Each instance of the server will be listening on one port. You might have to have multiple instances of the server. Have a look at this. You can change the ports of each of the instances as mentioned in that wiki.
Thanks for the kind reminder, I didn't read the policy carefully enough
As for the ports, is there any way other than running two instances of JBoss? Like in Tomcat, we just need to define a new service, but JBoss 4.2.1 only supports a subset of attributes of Tomcat's server.xml.
As for the ports, is there any way other than running two instances of JBoss?
Good question! A little bit of digging led me to this wiki entry VirtualHosts. In one of my test setup with JBoss 4.0.5, i added the following to the existing server.xml:
Note the config marked in bold for port 9080. It wasnt present earlier, i just added to the file to figure out whether i am able to access the application deployed on JBoss now on both 8080 and 9080. I was able to.
In your question, you also mentioned that
and webApp1 cannot be accessed through 8180, and webApp2 not through 8180
I havent yet looked into this, whether this would be possible.
Alternately, instead of accessing the application on different ports, why not access the application using 2 different hosts (virtual hosts). Something like for app1 http://www.myapp1.com and for app2 http://www.myapp2.com. If this approach is OK for you, then look into the same virtual hosts wiki article that i posted above. This way your webapp1 wont be available on www.myapp2.com and webapp2 wont be available on www.myapp1.com. I havent personally tried any of these, so not sure if you are going to run into any issues. But this should atleast give you a start. Let us know if you run into any issues. [ July 24, 2007: Message edited by: Jaikiran Pai ]