8 Replies Latest reply on Apr 26, 2013 1:42 PM by mbabacek

    issues with 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 application also runs fine when hit directly on an application server.

       

      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

       

      This is the info dump from mod_cluster-manager.  The application MyApp, which should be on the context root, is on ajp port 8039.  As you can see, mod_cluster does not register either the alias my.example.com nor the context root /.

       

      Node: [1],Name: e6381844-066b-3368-896e-f546e83010d7,Balancer: mycluster,LBGroup: ,Host: 172.19.49.159,Port: 8049,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Node: [2],Name: 95a95bc1-7585-39dd-b701-1457b0804232,Balancer: mycluster,LBGroup: ,Host: 172.19.49.159,Port: 8019,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Node: [3],Name: 8c2a290a-1f52-37af-8e71-85d69ca89339,Balancer: mycluster,LBGroup: ,Host: 172.19.49.160,Port: 8019,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Node: [4],Name: f2b6d2e2-14d5-3d56-a09d-635c58272eb1,Balancer: mycluster,LBGroup: ,Host: 172.19.49.159,Port: 8039,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Node: [5],Name: 9b147b77-5f46-3712-aad2-5569460c895f,Balancer: mycluster,LBGroup: ,Host: 172.19.49.160,Port: 8039,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Node: [6],Name: 5f622ae1-6233-3971-967d-4008d7e919f9,Balancer: mycluster,LBGroup: ,Host: 172.19.49.160,Port: 8049,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 100

      Vhost: [2:1:1], Alias: 192.168.1.2

      Vhost: [2:1:2], Alias: default-host

      Vhost: [3:1:3], Alias: default-host

      Vhost: [3:1:4], Alias: 192.168.1.2

      Context: [2:1:1], Context: /OtherApp, Status: ENABLED

      Context: [3:1:2], Context: /OtherApp, Status: ENABLED

       

       

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

        • 1. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
          jfclere

          The ROOT in disabled by default See excluded-contexts in http://docs.jboss.org/mod_cluster/1.2.0/html_single/#java.properties

          For the alias that looks weird, would it be possible to debug (conf/htttpd.conf LogLevel debug) and look for CONFIG MPM in errror_log?

          1 of 1 people found this helpful
          • 2. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
            kclair-rei

            I was able to fix this issue by adding the following attribute to the mod-cluster configuration in domain.xml:  excluded-contexts="admin-console,invoker,jbossws,jmx-console,juddi,web-console"

             

            I'm a bit confused, though, because I have two applications running on two different profiles, like so:

             

            App1 -> profile="ha"

            App2 -> profile "ha-app2"

             

            The ha-app2 profile has the following virtual-server configuration:

            <virtual-server name="default-host" default-web-module="app2" enable-welcome-root="false">

              <alias name="app2.mydomain.com"/>

            </virtual-server>

             

            I only added the excluded-contexts attribute to the ha-app2 profile.  Yet, now both of the following work and load the app2 application:

            http;//192.168.1.2/

            http://app2.mydomain.com/

             

            Additionally, this works:

            http://app2.mydomain.com/App1

             

            I was hoping to be able to restrict the app2 application to http://app2.mydomain.com as well as to prevent any other contexts from working on app2.mydomain.com.  Is this possible?

             

            app2.mydomain.com actually resolves to 192.168.1.2 since we are using name-based virtual hosts.

             

            Thanks!

            • 3. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
              jfclere

              Try one of the following:

              1 - auto-enable-contexts="false" and enable the context /App1 in the jboss-cli.sh

              2 - use mod_rewrite and forbid [F] all URL except /App1 for that VirtualHost in httpd.conf

              • 4. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
                kclair-rei

                Would this be different if the applications were defining a virtual-server in jboss-web.xml?  I.E. in that case would the applications only respond with that hostname?

                • 5. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
                  kclair-rei

                  also, I was not able to enable contexts through the cli - we are running domain mode. I found this bug, which appears to be resolved:

                  https://issues.jboss.org/browse/JBPAPP6-812

                   

                  The fix version in that ticket is 6.0.0, and we are running 6.0.1.  This is happening in both the context of a profile and the runtime:

                   

                  [domain@localhost:9999 subsystem=modcluster] pwd

                  /host=testhost/server=myapp/subsystem=modcluster

                  [domain@localhost:9999 subsystem=modcluster] :read-operation-names

                  {

                      "outcome" => "success",

                      "result" => [

                          "add",

                          "read-attribute",

                          "read-children-names",

                          "read-children-resources",

                          "read-children-types",

                          "read-operation-description",

                          "read-operation-names",

                          "read-resource",

                          "read-resource-description",

                          "remove",

                          "undefine-attribute",

                          "whoami",

                          "write-attribute"

                      ]

                  }

                   

                  [domain@localhost:9999 subsystem=modcluster] pwd

                  /profile=ha/subsystem=modcluster

                  [domain@localhost:9999 subsystem=modcluster] :read-operation-names

                  {

                      "outcome" => "success",

                      "result" => [

                          "add",

                          "read-attribute",

                          "read-children-names",

                          "read-children-resources",

                          "read-children-types",

                          "read-operation-description",

                          "read-operation-names",

                          "read-resource",

                          "read-resource-description",

                          "remove",

                          "undefine-attribute",

                          "whoami",

                          "write-attribute"

                      ]

                  }

                   

                  I've been trying to find an example of what the resulting xml would look like, but I've been unable to find this.

                  • 6. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
                    rhusar

                    Kristina Clair wrote:

                     

                    also, I was not able to enable contexts through the cli - we are running domain mode. I found this bug, which appears to be resolved:

                    https://issues.jboss.org/browse/JBPAPP6-812

                    That issue was rejected -- see why https://issues.jboss.org/browse/JBPAPP6-812?focusedCommentId=12692686&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12692686

                     

                    It should work when you apply the operation on the runtime -- can you paste the stack trace or an error message?

                    • 7. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
                      kclair-rei

                      Where can I apply the enable-contexts operation on the runtime?  I thought that's what I was attempting to do here:

                       

                      [domain@localhost:9999 subsystem=modcluster] pwd

                      /host=testhost/server=myapp/subsystem=modcluster

                      [domain@localhost:9999 subsystem=modcluster] :read-operation-names

                      {

                          "outcome" => "success",

                          "result" => [

                              "add",

                              "read-attribute",

                              "read-children-names",

                              "read-children-resources",

                              "read-children-types",

                              "read-operation-description",

                              "read-operation-names",

                              "read-resource",

                              "read-resource-description",

                              "remove",

                              "undefine-attribute",

                              "whoami",

                              "write-attribute"

                          ]

                      }

                      • 8. Re: issues with mod_cluster, virtual hosts, and jboss root context in JBoss EAP 6
                        mbabacek

                        Kristina, this is how one does it:

                         

                        List what contexts are excluded at the moment:

                        ls /subsystem=modcluster/mod-cluster-config=configuration/

                         

                        Write your own (added HELL to the default in this example)

                        /subsystem=modcluster/mod-cluster-config=configuration/:write-attribute(name=excluded-contexts, value="ROOT,invoker,jbossws,juddi,console,HELL")

                         

                        HTH