3 Replies Latest reply on Feb 23, 2012 6:04 AM by rhusar

    JBoss 7.1 clustering standalone questions

    redmond007

      I'm in the process of setting up a JBoss 7.1 HA cluster in standalone mode using Amazon ELB as a load balancer.  I wasn't able to find much literature on how to do this.  The most complete documentation I was able to find covered how to set up a JBoss 7 cluster in domain mode with mod_cluster.  I've been using the JBoss 7 clustering webinar http://www.youtube.com/watch?v=rw4GpBepceY and the AS7 clustering how-to (mainly for domain configurations) https://community.jboss.org/wiki/AS7ClusterHowto as reference.

       

       

      My app is a clustered web application, we'd like to cluster this application so that session information is shared between the two nodes in the cluster.  Right now we're able to run it non clustered behind the Amazon ELB.  I was able to start JBoss using standalone-ha.xml on both nodes, and looks like my application deployed cleanly.  I see channels and cache being created on both nodes in the logs.  However when I try to log into my app I get the error:

       

      java.lang.IllegalArgumentException: JBAS018062: Specified attribute cannot be replicated
                org.jboss.as.web.session.ClusteredSession.setAttribute(ClusteredSession.java:807)
                org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130)
                com.mycompany.common.servlet.UserSession.EnterpriseLogin(UserSession.java:58)
                com.mycompany.enterprise.controllers.Login.execute(Login.java:122)
                org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
                org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
                org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
                org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
                javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
                javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
                org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
                org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
                org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
                org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
      
      

      Looks like the cluster can't replicate 'UserSession' class across both nodes from what I can tell.  The code in my UserSession.java class looks like

       

       

          public static final User EnterpriseLogin(HttpServletRequest request, String username, String password) throws Exception
          {
              String addr = request.getRemoteAddr();
              String host = request.getRemoteHost();
      
              User user = SecurityService.Login(username, password, host);
      
              if (user != null && 
                                  (user.getLdapError() == null || user.getLdapError().equalsIgnoreCase("")))
              {
                        UserSession userSession = new UserSession();
                  userSession.setUser(user);
                  request.getSession(true).setAttribute(UserSession.class.getName(), userSession);
                  request.getSession(true).setMaxInactiveInterval(-1);
              }
      
              return user;
          }
      
      

      I'm not sure what I have to do at this point that will allow my JBoss cluster to replicate UserSession across both nodes.  Does this class need to be added to my persistence.xml somehow?  or do I need to annotate this class to make it 'replicatable'?  I'm really stuck on this problem and none of the documentation I find seems to address this what may be causing this problem.

       

       

      I have a couple other general questions regarding JBoss 7 clustering - the documentation states if two HA nodes are started on the same network, they will form a cluster.  How can I tell from the logs which nodes have joined the cluster?  Also is it possible to specify which nodes can join the cluster by IP?

       

       

      Also any general information on configuring a cluster in standalone mode would be very appreciated.  Thanks.

        • 1. Re: JBoss 7.1 clustering standalone questions
          rhusar

          Just quickly looking, "JBAS018062: Specified attribute cannot be replicated" means that your object (namely its attribute) is not serializable. Google around for how to implement Serializable properly.

          1 of 1 people found this helpful
          • 2. Re: JBoss 7.1 clustering standalone questions
            redmond007

            Thank you!  adding 'implements java.io.Serializable' to my class got me past that obstacle.

             

            I'm now able to use my web app, but I'm not confident that my two nodes are joining the same cluster.  One of the nodes displays

             

            'Number of cluster members: 1' in the logs - there's no mention of the other node joining the cluster at any point in the logs.  My two nodes are Amazon EC2 instances, and are in different geographical regions.  Is there any way to tell which nodes are connected to a particular cluster by IP, and if it's possible to specify by IP which nodes should be able to join the cluster?  I'm not sure the two nodes consider thenselves to be on the same virtual network and may  not be communicating properly.  Thanks.

            • 3. Re: JBoss 7.1 clustering standalone questions
              rhusar

              'Number of cluster members: 1' in the logs - there's no mention of the other node joining the cluster at any point in the logs.  My two nodes are Amazon EC2 instances, and are in different geographical regions.  Is there any way to tell which nodes are connected to a particular cluster by IP, and if it's possible to specify by IP which nodes should be able to join the cluster?  I'm not sure the two nodes consider thenselves to be on the same virtual network and may  not be communicating properly.  Thanks.

              You started a discussion here, so lets continue there:

              https://community.jboss.org/message/718901#718901