• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploy web apps on different ports

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Jaikiran.

Yes, I am also considering the virtual hosts approach...
 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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?

 
reply
    Bookmark Topic Watch Topic
  • New Topic