users@glassfish.java.net

Creating a new virtual server

From: <glassfish_at_javadesktop.org>
Date: Sat, 05 May 2007 18:38:16 PDT

Sun Java System Application Server 9.1 (build b41-beta2)

JDK 1.5, Solaris 10 running within a zone.

Simply put, I want to run a "normal" website using Glassfish, since it's also running the main application.

This site will be on a different domain, but on the same server.

My plan was to create a web-module entry that is backed by a static directory with the "location" attribute, rather than by deploying a WAR file. This would allow the users to simply FTP files up and down to that static site and treat it like any other web site. That's the goal anyway.

But I first wanted to see if I could just get a Virtual Server working at all, so I created a simple WAR to deploy.

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/j2ee-modules/example"
    name="example" object-type="user"/>
[/code]

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.

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.

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?

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?

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"?

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?

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

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