JBoss 7.1 clustering standalone questions
redmond007 Feb 22, 2012 1:28 PMI'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.