4 Replies Latest reply on Jul 18, 2007 3:03 PM by jaikiran pai

    Sharing wars between virtual hosts

    Steve Vangasse Newbie

      Hi,
      I'm moving my application from Tomcat to JBoss and I have a question. I need to allow multiple virtual hosts to use the same wars. On Tomcat I did this with hosts described in server.xml and context fragments (TOMCAT_DIR/conf/Catalina/my-host.com/ROOT.xml) for each domain. Within these context fragments I gave each virtual host it's own JNDI key so that it had access to it's data.

      In JBoss I have moved the wars into an ear. From what I can gather, virtual hosting is then managed by a jboss-web.xml file in the WEB-INF directory of each WAR. This doesn't seem to give me the option of setting up each context with it's own JNDI key. Can I use the Tomcat context fragments solution in JBoss' jbossweb-tomcat55.sar/conf directory?

      Thanks,

      Steve

        • 1. Re: Sharing wars between virtual hosts
          Steve Vangasse Newbie

          I think this is actually just a JNDI question. In JBoss, is there a JNDI context for each web context or virtual host, and if so where is it configured?

          I've been looking at the JBoss Wiki:

          http://wiki.jboss.org/wiki/Wiki.jsp?page=JNDIBindingServiceMgr

          and this page looks like it could be the way to go but the documentation is a bit brief. Does anyone know the answer to this?

          Thanks,

          Steve

          • 2. Re: Sharing wars between virtual hosts
            jaikiran pai Master

             

            In JBoss, is there a JNDI context for each web context


            Are you looking for "env-entry" for each web context, in which case each of the web-context will have the entry in its own java:/comp/env namespace.

            More details about env-entry can be found in the dtd of web.xml at http://java.sun.com/dtd/web-app_2_3.dtd:

            <!--
            The env-entry element contains the declaration of a web application's
            environment entry. The declaration consists of an optional
            description, the name of the environment entry, and an optional
            value. If a value is not specified, one must be supplied
            during deployment.
            -->
            <!ELEMENT env-entry (description?, env-entry-name, env-entry-value?,
            env-entry-type)>
            
            <!--
            The env-entry-name element contains the name of a web applications's
            environment entry. The name is a JNDI name relative to the
            java:comp/env context. The name must be unique within a web application.
            
            Example:
            
            <env-entry-name>minAmount</env-entry-name>
            
            Used in: env-entry
            -->
            <!ELEMENT env-entry-name (#PCDATA)>




            • 3. Re: Sharing wars between virtual hosts
              Steve Vangasse Newbie

              Thanks for getting back to me. I think what you're describing is a env-entry for a certain web-app that can be defined in web.xml. This would then be the same for all virtual hosts that use this web app.

              I'm looking for a env-entry for each virtual host. So that depending on which domain name is used, a different env-entry will be listed in the java:/comp/env namespace.

              In Tomcat this can be configured in seperate context.xml fragments under TOMCAT_DIR/conf/Catalina/virtual-host1.com/ and TOMCAT_DIR/conf/Catalina/virtual-host1.com/

              Any idea how this can be achieved under JBoss?

              • 4. Re: Sharing wars between virtual hosts
                jaikiran pai Master

                 

                Any idea how this can be achieved under JBoss?


                Sorry Steve, i havent done that before and lack knowledge, for answering this.