1 Reply Latest reply on May 9, 2013 11:15 AM by rhusar

    mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6

    kclair-rei

      We're running Apache 2.2, mod_cluster 1.1, and JBoss EAP 6.0.1 (JBoss 7) on linux.

       

      I'm trying to set up virtual hosts in JBoss without setting the virtual host in jboss-web.xml.  The goal is for http://my.example.com/ to route through apache/mod_cluster and serve the application running on the context root /.   The application runs fine in standalone mode.

       

      The apache configuration: 

      LoadModule slotmem_module       modules/mod_slotmem.so 
      LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
      LoadModule advertise_module     modules/mod_advertise.so
      LoadModule manager_module       modules/mod_manager.so 

      Listen 192.168.1.2:6666
      <VirtualHost 192.168.1.2:6666>
        ManagerBalancerName mycluster
        ServerAdvertise On
        CreateBalancers 0
        ... other content snipped ...
      </VirtualHost> 

      <VirtualHost *:80>
        ServerAdmin my@email.address
        ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On
        ProxyPassReverse / balancer://mycluster
        ProxyPreserveHost On
        ServerName my.example.com
      </VirtualHost>

       

      The application has this content for jboss-web.xml:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <jboss-web>
        <context-root>/</context-root>
      </jboss-web>

      The profile used by the server where the application is deployed is configured thusly:

      <virtual-server name="default-host" enable-welcome-root="false" default-web-module="my-app-name">
        <alias name="my.example.com"/>
      </virtual-server>

      And we have an app with a war file named my-app-name.war.  (I have tried this with and without default-web-module provided, with the same result)

      When I start jboss on the application servers, they appear to start the application without a problem:

      [Server:MyApp] 12:17:34,786 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: 
      [Server:MyApp] 12:17:34,811 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "my-app-name.war"
      [Server:MyApp] 12:17:34,823 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4)
      started in 35274ms - Started 502 of 649 services (146 services are passive or on-demand)
      [Host Controller] 12:17:34,829 INFO  [org.jboss.as.host.controller] (proxy-threads - 1) JBAS010919: Registering server MyApp

      When I try to go to http://my.example.com, I get the apache error:

      proxy: CLUSTER: (balancer://mycluster). All workers are in error state 

      When I inspect /mod_cluster-manager on the webserver, I do not see the context root for / defined.  I do, however, see the context root defined by another app in the same cluster, which is using a different profile:

      context: 1 [/OtherApp] vhost: 1 node: 3 status: 1 
      context: 2 [/OtherApp] vhost: 1 node: 2 status: 1

      The other application runs fine on http://192.168.1.2/OtherApp.