3 Replies Latest reply on Oct 11, 2012 10:20 AM by sourav bairagi

    Jboss AS 7.1.1.Final and Apache Http server 2.2 clustering problem..

    sourav bairagi Newbie

      I trying to understand standalone mode clustering of Jboss in windows xp using APACHE  2.2 and HTTPD 2.2 and Jboss AS 7.1.1.Final and it was successful with the application shown below,

       

      @Stateless

      @Clustered

      @Named

      public class ClusteredStatelessBean {

          private final static Logger LOG =

                  Logger.getLogger(ClusteredStatelessBean.class.getName());

          public String getNodeName() {

              LOG.info("invoke getNodeName()");

              try {

                  String jbossNodeName =

                          System.getProperty("jboss.node.name");

                  return jbossNodeName != null ? jbossNodeName :

                          InetAddress.getLocalHost().getHostName();

              } catch (UnknownHostException e) {

                  throw new RuntimeException(e);

              }

          }

      }

       

      @Stateful

      @SessionScoped

      @Clustered

      @Named

      public class ClusteredStatefulBean {

          private final static Logger LOG =

                  Logger.getLogger(ClusteredStatefulBean.class.getName());

          private int counter;

          public int getCounterValue() {

              LOG.info("invoke getCounter()");

              return counter++;

          }

          @PrePassivate

          public void passivate() {

              LOG.info("passivate ejb component: " + this);

          }

          @PostActivate

          public void activate() {

              LOG.info("activate ejb component: " + this);

          }

      }

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

         xmlns:h="http://java.sun.com/jsf/html"

         xmlns:ui="http://java.sun.com/jsf/facelets">

                <h:head>

                   <title>Cluster example</title>

                   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                            <link rel="shortcut icon"

                                              href="#{facesContext.externalContext.requestContextPath}/favicon.ico"

                                              type="image/x-icon" />

                </h:head>

                <h:body>

                          <h1>JBoss AS 7 - cluster demo</h1>

                            <p>Node: #{clusteredStatelessBean.nodeName}</p>

                          <p>Replicated counter: #{clusteredStatefulBean.counterValue}</p>

                </h:body>

      </html>

       

       

      The example stateful session bean is a CDI component associated to the HTTP session. The bean has a counter which is increased every time it is read by the getter-method getCounterValue(). With the counter you can track how often the bean was invoked during the session.

       

       

      in the apche httpd.config i have done the following

      added this following modules,

      LoadModule proxy_module modules/mod_proxy.so

      LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

      LoadModule slotmem_module modules/mod_slotmem.so

      LoadModule manager_module modules/mod_manager.so

      LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

      LoadModule advertise_module modules/mod_advertise.so

       

       

      also added the following

      # MOD_CLUSTER_ADDS

      # Adjust to you hostname and subnet.

       

      <IfModule manager_module>

        Listen 127.0.0.1:6666

        ManagerBalancerName mycluster

         <VirtualHost 127.0.0.1:6666>

          <Location />

            Order deny,allow

            Deny from all

            Allow from 127.0.0.

          </Location>

          KeepAliveTimeout 300

          MaxKeepAliveRequests 0

          #ServerAdvertise on http://@IP@:6666

          AdvertiseFrequency 5

          #AdvertiseSecurityKey secret 

          #AdvertiseGroup @ADVIP@:23364

          EnableMCPMReceive

          <Location /mod_cluster_manager>

            SetHandler mod_cluster-manager

            Order deny,allow

            Deny from all

            Allow from 127.0.0.

          </Location>

        </VirtualHost>

      </IfModule>

       

       

      But when i went on further and deployed my own application which uses javax.persistence, richfaces and hibernate along with JSF. while we are running a single node jboss standalone cluster the application runs fine and smooth using apache httpd url  ie http://127.0.0.1/WiseBank_CBS_v1/login.xhtml.

       

       

      but when running more then one standalone jboss node of jboss, when ever i access the above url in jboss server node i see lots of error trace which i am unable to debug. attaching the jboss server log.

       

       

      Can you plz suggest me an way out of this ...

       

       

      thanks in advance