users@glassfish.java.net

Re: Creating a new virtual server

From: <glassfish_at_javadesktop.org>
Date: Sun, 06 May 2007 10:22:43 PDT

Hi,
I will try to answer some of your questions here.
Some general information first:
I want to know if you are running developer profile or cluster profile since there is a little difference on how to specify the Virtual Server field in deployment and editing of deployed application in Admin Console.
In developer profile, you specify the VS during deployment.
In cluster profile, you specify the 'target' during deployment. Each target being a standalone server instance or cluster. After deployment, you go to the Target page, and select the VS if you want to change the default, which is ALL VS for this target.

Also, there is some subtleties regarding the VS field. If you leave that empty, it will apply to all VS, even the one you created later after the deployment.
If you specify all the VS one by one, then any newly added VS after the deployment will not be included, you need to modify the VS list manually.

Specifying "/" as the context root has different implication then specifying "" as the context root by leaving the field empty.
If you leave the field empty both in GUI or CLI, the deployment backend will use the default, ie, the application name as the context root.
There is some discussion in https://glassfish.dev.java.net/issues/show_bug.cgi?id=2853 that you may want to take a look.

We realize there is some deficiency in GUI in handling Virtual Server for deployment for the developer profile and is working on that.
You can check out this issue: https://glassfish.dev.java.net/issues/show_bug.cgi?id=2918
We expect issue # 2918 be fixed in build 47 or 48. However that only affect developer profile. So, if you are using developer profile, you may want to use that build when it is available.

Please see comments below:

> Using the admin console, the following bits were
> added to the domain.xml:
>
> [code]
> <virtual-server hosts="example.com"
> http-listeners="http-listener-1"
> id="example"
> log-file="${com.sun.aas.instanceRoot}/logs/server.log
> state="on">
> <property name="sso-enabled"
> value="false"/>
> <property name="docroot"
> value="${com.sun.aas.instanceRoot}/docroot"/>
> <property name="accesslog"
> value="${com.sun.aas.instanceRoot}/logs/access"/>
> /virtual-server>
> [/code]
>
> I then deployed a WAR that should be run on that
> server. The WAR is basically a bunch of HTMLs, and a
> token WEB-INF/web.xml and sun-web.xml to set the
> context root to /.
>
> [code]
> <web-module availability-enabled="false"
> context-root="/"
> directory-deployed="false" enabled="true"
> location="${com.sun.aas.instanceRoot}/applications/j2
> e-modules/example"
> name="example" object-type="user"/>
> [/code]
>

Is this also extracted from 'domain.xml' ? If so, it means deployment went through.
But your next sentence said the deployment failed. I am confused.

> As you can imagine (being as I'm here), this isn't
> working. When I deploy the web app, I get an error:
>
> Trying to create reference for application in target
> server failed; The context root [] in application
> [example] is already in use by another application on
> this instance [server].
>
> Now, in one sense, this makes complete sense, as I DO
> have another app mapped to the root-context, but it's
> on the "server" instance, not the "example"
> instance.
>
But the error above suggested server instance, not example instance.
example is your application name.


> I have several questions.
>
> 1) Where is the association made between a web-module
> and a virtual server? I don't see anything obvious in
> the domain.xml file. There are entries for it on the
> page in the console, as well as options for them in
> the asadmin deploy command.
>
virtual server is specifed in the application-ref.
[code]
<!ATTLIST application-ref
    enabled %boolean; "true"
    virtual-servers CDATA #IMPLIED
    lb-enabled %boolean; "false"
    disable-timeout-in-minutes CDATA "30"
    ref CDATA #REQUIRED>
[/code]

eg, if i deploy hello.war in developer profile and fill in myVS as the virtual server
during deployment, i see the following:
[code]
<application-ref disable-timeout-in-minutes="30" enabled="true" lb-enabled="false"
ref="hello" virtual-servers="myVS"/>
[/code]

> 2) I notice that there is a "docroot" property on the
> Virtual Server. Can I simply use that to point to my
> static content rather than having to create and
> deploy a skeletal web app?

Yes, you should be able to.

>
> 3) There is a "context-root" parameter on the
> web-module element. Does that override the
> context-root in the sun-web.xml? I simply set that to
> "" or "/" for my website?

Yes. 'context-root' specified during deployment, which is the web-module 'context-root'
element will override the one specified in sun-web.xml


>
> 4) Do I need to reconfigure the base server of the
> container to be more "specific" for which hosts it's
> listening for? As in, the default listener is
> listening for "everything", while my new virtual
> server is listening for a specific host. Is that the
> source of the conflict?
>
> 5) If I have subdomains (i.e. example.com,
> www.example.com, etc.) do I need to create a seperate
> virtual server for each one, or can I do
> "*.example.com"?
>
I think you should create 1 http-listener for each VS that you want if you want the VS
 to listen to different port. And create the VS one by one.
 

> 6) In DNS, I have about 8 domains pointing to the
> same IP, and all of them (save this one) should
> simply go to the default web site. Would I need to
> create virtual servers for all of them as well?
>
Someone please correct me if i am wrong.
I will create 7 virtual servers and point to the same http-listener.
Then create another http-listener and have this VS point to this special http-listener.

thanks
Anissa

> Thanks for any insight you can provide.
[Message sent by forum member 'anilam' (anilam)]

http://forums.java.net/jive/thread.jspa?messageID=215739