Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to deploy different war on different port?

 
Mehta Mohit
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

we have two WAR packaged into single EAR file now I want this WAR to be deployed on different port
for example
we have two application - app1 and app2 with different root context
http://10.22.22.34:8080/app1
and
http://10.22.22.34:8080/app2

Now due to security constrains we want to run one application on different port instead of 8080.
http://10.22.22.34:8088/app2

Is it possible to consigure WAR to run on different port?
How can we achive this?
Will this require changes only in packaging war or its dependent of Application server also?

Please help.


 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ports the server uses is something you define in the server, not the application. So you can't do this by changing the WAR file.

Normally, servers only listen on one port (or range of ports). There are some (such as WebSphere) that allow you to define distinct virtual hosts which use differernt ports, but you can't deploy one EAR into two virtual hosts in the way you would like.

One way to do it is to put some sort of proxy in front of your web servers that redirects based on the context in the URL. Soemthing fairly basic like Apache HTTP server will do this.
 
Mehta Mohit
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Thanks for reply

I have Glassfish server to deploy my application EAR

Two WAR what we have is web services expossed with different context to control its accessiblity.
In Glassfish I have seen that we can create Virtual server and can deploy application to that virtual server
Is it possible to configure such virtual server for each WAR inside EAR?

Or Can anyone suggest any other way to package 2 WAR in signle EAR still having different Port configured?

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm no Glassfish expert but I'd expect this can't be done. You certainly can't do it in any of the server I do know (so if a solution exists for Glassfish its not going to be portable). Configuration of the server itself is not normally something you can do from the JEE artifact.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic