how to configure multiple virtual hosts for the same context root /
Hi,
I am using Glassfish V1 U1 - b14 on Solaris.
I am trying to configure two applications to be mapped to the / root context, each one in its own virtual host.
Two things I have noticed:
1. I have to manually add virtual-hosts="hostId" in domain.xml/application-ref ... looks like just simply deploying the app does not do that although the application is set as default for its particular virtual host. Is this a bug?
2. Although I have set for each virtual host the default web-app correctly, and they both respond fine, I cannot map both of them to the / context. The second application (chronologically deployed) does not respond when called with the / context ....
Any ideas? Is this a bug again?
Regards,
Rares
Message was edited by:
raresp
[815 byte] By [
rarespa] at [2007-11-14]

Do you have separate and distinct HTTP Listeners for each virtual server? Another words, HTTP Listener one go only to virtual server one and HTTP Listener two go only to virtual server two?
If you have one HTTP Listener that goes to two virtual servers, then the context is ambiguious.
Mike
No, I am not saying two listener listening to the same port. Virtual servers have can listen to multiple HTTP listeners. If you have two virtual servers associated with the same HTTP listener, you can not have different apps with the same context root.
In the admin open up Configuration | HTTP Service | Virtual Servers. When you click on your virtual servers there is a field called "HTTP Listeners:". You can have multiple HTTP Listeners here.
Mike
Wow, that's a shame. All mighty Application Server and two different apps on two different virtual hosts are considered ambiguous to have the same context root definition.... Fair play to Tomcat and 90% of the rest of servlet containers!
In my case I have the same EAR we are planning to deploy to many (up to 30) virtual hosts. Faking different context roots for each deployment will bring unnecessary overheads...
Should I file a bug or feature request?
Thanks again for your answer, although you're basically saying it is not possible I will wait and look a while for a possible solution before bringing this topic to a conclusion.
I don't think that you understand what I am saying. If you have two HTTP Listeners 1 and 2. 1 listens on port 8080 and 2 listens on port 8081. Now you have two virtural servers 1 and 2. Virtual server one listens to HTTP Listener 1 and 2. Virtural server two listens to HTTP Listener 2.
Now you deploy 2 apps we with context root abc to each virtual servers. If someone does http://localhost:8081/abc, what application should it run? Two virtual servers are listening to HTTP Listener 2. If the context roots are the same, it won't know which one to you.
I am saying, check to make sure that this is what you have set up.
Mike
Mike thanks for answering again. I understood completely what you said with the listeners and their corresponding ports. It is just not an option for me. I need to deploy the same EAR to many virtual hosts, up to 50. Allocating a port for each one is not an option, I need them all on port
Hello,
I guess the concept lets you define multiple virtual servers that listen to the same "Listener". You can separate them entering different hosts. For e.g. webapp1.yourdomain.com for webapp1, webapp2.yourdomain.com for webapp2 and so on.
Unfortunately it fails with Sun Java System Application Server Platform Edition 9.0_01