3 Replies Latest reply on Feb 17, 2004 11:11 AM by erik777

    setting up a virtual host with 3.2.3 (without Apache)

    martinbrice

      Howdy. I've seen quite a few questions about this on the web, but unfortunately I haven't found any answers. :< I was wondering if someone had a web link or could offer some help with setting up virtual hosts?

      I've setup Tomcat (latest prod) at home last night, and got virtual hosts working there (created three wars, and edited the XP lmhosts file), and it was great. I thought this would work (with some minor changes for the deploy dir for JBoss), but it didn't work on my JBoss-3.2.3 on my RH9 box. Has anyone tried this? Can you offer any help? I figure it's a simple thing to setup, but I without the magic xml nodes and attributes, I'm left without a running server. :<

      Thanks for any help.

      PS I put this in here (FAQ) cause I've seen a lot of ppl ask for this info, but either have Apache or didn't get any answers.

        • 1. Re: setting up a virtual host with 3.2.3 (without Apache)
          erik777

          As described in the admin/devl guide, do the following.

          Step 1: Define the hosts in the jbossweb-tomcat41.sar/META-INF/jboss-service.xml Config attribute fragment:

           <attribute name="Config">
           <Server>
           <Service name="JBoss-Tomcat">
           <Engine name="MainEngine" defaultHost="vhost1">
           <Logger className="org.jboss.web.tomcat.Log4jLogger"
           verbosityLevel="debug" category="org.jboss.web.localhost.Engine"/>
          
           <Host name="vhost1">
           <Alias>vhost1.starkinternational.com</Alias>
          
           <Valve className="org.apache.catalina.valves.AccessLogValve"
           prefix="vhost1" suffix=".log"
           pattern="common" directory="/log"/>
           <Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
           <!-- Default context parameters -->
           <DefaultContext cookies="true" crossContext="true" override="true"/>
           </Host>
          
           <Host name="vhost2">
           <Alias>vhost2.starkinternational.com</Alias>
           prefix="vhost2" suffix=".log"
           pattern="common" directory="/log"/>
          
           <!-- Access logger -->
           <Valve className="org.apache.catalina.valves.AccessLogValve"
           prefix="vhost2" suffix=".log"
           pattern="common" directory="/log"/>
           <Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
           <!-- Default context parameters -->
           <DefaultContext cookies="true" crossContext="true" override="true"/>
           </Host>
           </Engine>
          
           <!-- A HTTP/1.1 Connector on port 8080 -->
           <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
           address="" port="8080" minProcessors="5"
           maxProcessors="100" enableLookups="true" acceptCount="10" debug="0"
           connectionTimeout="20000" useURIValidationHack="false"/>
           </Service>
           </server>
           </attribute>
          
          


          Step2: Define the Host to which the web app should be deployed using the WEB-INF/jboss-web.xml descriptor virtual-host element:

          <jboss-web>
           <!-- Deploy this war to vhost2 -->
           <virtual-host>vhost2.starkinternational.com</virtual-host>
          </jboss-web>
          



          • 2. Re: setting up a virtual host with 3.2.3 (without Apache)
            starksm64

            As described in the admin/devl guide, do the following.

            Step 1: Define the hosts in the jbossweb-tomcat41.sar/META-INF/jboss-service.xml Config attribute fragment:

             <attribute name="Config">
             <Server>
             <Service name="JBoss-Tomcat">
             <Engine name="MainEngine" defaultHost="vhost1">
             <Logger className="org.jboss.web.tomcat.Log4jLogger"
             verbosityLevel="debug" category="org.jboss.web.localhost.Engine"/>
            
             <Host name="vhost1">
             <Alias>vhost1.starkinternational.com</Alias>
            
             <Valve className="org.apache.catalina.valves.AccessLogValve"
             prefix="vhost1" suffix=".log"
             pattern="common" directory="/log"/>
             <Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
             <!-- Default context parameters -->
             <DefaultContext cookies="true" crossContext="true" override="true"/>
             </Host>
            
             <Host name="vhost2">
             <Alias>vhost2.starkinternational.com</Alias>
             prefix="vhost2" suffix=".log"
             pattern="common" directory="/log"/>
            
             <!-- Access logger -->
             <Valve className="org.apache.catalina.valves.AccessLogValve"
             prefix="vhost2" suffix=".log"
             pattern="common" directory="/log"/>
             <Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
             <!-- Default context parameters -->
             <DefaultContext cookies="true" crossContext="true" override="true"/>
             </Host>
             </Engine>
            
             <!-- A HTTP/1.1 Connector on port 8080 -->
             <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
             address="" port="8080" minProcessors="5"
             maxProcessors="100" enableLookups="true" acceptCount="10" debug="0"
             connectionTimeout="20000" useURIValidationHack="false"/>
             </Service>
             </server>
             </attribute>
            
            


            Step2: Define the Host to which the web app should be deployed using the WEB-INF/jboss-web.xml descriptor virtual-host element:

            <jboss-web>
             <!-- Deploy this war to vhost2 -->
             <virtual-host>vhost2.starkinternational.com</virtual-host>
            </jboss-web>
            



            • 3. Re: setting up a virtual host with 3.2.3 (without Apache)
              erik777

              This certainly helped, as it now recognizes the virtual-host setting. However, my problem is that I need it to support multiple virtual host settings. This is to support escalation from development to testing to production, each having a diferent virtual host name.

              I have alias tags in the host setting of jbossweb-service.xml. If I change the virtual-host setting in jboss-web.xml to any of them, it works only for that host name. This is good in that it indicates that my alias tags are working. However, I need it to work for all the alias tags for that host.

              If I try to set more than one virtual-host tag, I get the following error:

              org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/jboss-web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: expected only one virtual-host tag)

              The bottom line is that JBoss needs to support multiple virtual-host tags, or have a means to support virtual host aliases.

              Is there a workaround? Is a fix in the works?