aspose file tools*
The moose likes JBoss/WildFly and the fly likes Deploy web apps on different ports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Deploy web apps on different ports" Watch "Deploy web apps on different ports" New topic
Author

Deploy web apps on different ports

Monica Jia
Greenhorn

Joined: Jul 23, 2007
Posts: 4
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?

Thanks!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10046
    
163

Hello "Mocha Java"

Welcome to JavaRanch

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.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10046
    
163

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.
Monica Jia
Greenhorn

Joined: Jul 23, 2007
Posts: 4
Hi Jaikiran,

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.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10046
    
163

Monica, thanks for changing your display name

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 ]
Monica Jia
Greenhorn

Joined: Jul 23, 2007
Posts: 4
Thank you very much Jaikiran.

Yes, I am also considering the virtual hosts approach...
Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202


With above suggestions and with help in wiki i tried virtual host concept in jboss, but i am getting 404 error while accessing the link. I will explain you clearly



I am using jboss 5.0.1 new app server

In default/deploy/jbossweb.sar--i opened server.xml and add below code



Port Number i set it to 80




Now i navigated back to myapp.war and edited jboss-web.xml available in WEB-INF folder. my jboss-web.xml is as below



Now I accessed http://myapphost i get page not found error. I have index.html in myapp.war folder <welcome-file-list>tags are available in web.xml and index.html is added to it also


Also, when i access http://www.myapp.com i find the same problem.

Please help me. Where i am going wrong?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploy web apps on different ports