10 Replies Latest reply on Jul 29, 2005 1:43 PM by Nitin Jain

    New to clustering

    Nitin Jain Newbie

      Hi There,

      I'm new to JBoss clustering. Can anyone provide me some help on how to create multiple node on same machine? How to implement load-balancing? How to deloy an .war. .rar and .ear files in clustered environment?

      I'm using JBoss 3.2.3

      Thanks in advance.


        • 1. Re: New to clustering
          vignesh vignesh Newbie


          To have multiple cluster nodes on the same machine, you would need a multihomed machine and then you could bind each jboss instance to a different IP adress by using

          run.sh -b <ip address>

          Though having a cluster just on one machine doesn't truly serve the purpose of clustering.

          For load balancing at the web tier, you can configure Apache web server as the frontend loadbalancer to load balance between multiple jboss nodes. For details refer to JBoss clustering docs available at.


          For clustering session and entity beans and configuring JBoss clustering, please refer to JBoss clustering documentation that contains all the information you need.

          • 2. Re: New to clustering
            Nitin Jain Newbie

            Thanks for a quick and prompt reply.

            I've created multihomed machine by configuring multiple ip address on same machine with the help of loopback adapter.

            Now the documentation you refered talks about some mod_jk libraries. And moreover it says that i need to install apache web server explicitly.

            But tell do need to do it because JBoss bundles tomcat with it.

            Please provide a way out.

            Thanks in advance.


            • 3. Re: New to clustering
              vignesh vignesh Newbie


              Yeah JBoss has tomcat bundled with it and each jboss instance will have tomcat running on it. Since all web requests are handled by tomcat, you need a loadbalancer in front of your JBoss nodes to loadbalace web requests between your JBoss instances. Apache web server is meant for that purpose and mod_jk is the module in Apache that enables communication with tomcat and loadbalancing web requests between tomcat instances. You could use a hardware loadbalancer as well for the same. This is the first level of loadbalancing for web requests that are handled by tomcat within JBoss. The architecture you want to implement is not really clear but if your system has EJBs and if the EJB tier would reside on separate instances than your web tier (sevlets, JSPs etc) then you could have another level of loadbalancing for ejb requests. This is accomplished by configuring HA-JNDI for EJB JBoss instances and adding clustering tags for your EJBs. All this is clearly explained in the documentation.

              • 4. Re: New to clustering
                Nitin Jain Newbie

                Thanks once again.

                I want to know that what all changes we are supposed to make to configure multiple nodes on single machine. And please help me in enabling session replication.

                I have a web application (.war) archive which connects to some repository using a JNDI look up with help of a resource adapter and some third party apis'.


                • 5. Re: New to clustering
                  Jerry Gauthier Apprentice

                  There are several ways to run multiple nodes from a single machine.

                  1) As noted in an earlier reply, you can configure multiple IP addresses on a machine and then start the JBoss server with an associated IP address (e.g., run.bat -c mynode1 -b

                  2) You can use a single IP address as long as you use a different set of ports for each server. The easiest way to accomplish this is via the Service Binding Manager, as described in the Services Binding Management section of the JBoss AS Guide. http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html#d0e23108

                  If you require load balancing, it can be achieved using Apache mod_jk as noted in an earlier post. This process is described in Chapter 6 of the JBoss AS Clustering Guide. See the section on configuring session replication and installing mod_jk.

                  The installation and configuration of mod_jk is also discussed on the JBoss Clustering wiki at http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss.

                  The wiki page notes that the worker.nodex.local_worker=1 entries in the configuration file must be commented out to achieve load balancing. This information isn't currently provided in the Clustering Guide so you need to do this if you want load balancing.

                  • 6. Re: New to clustering
                    Nitin Jain Newbie

                    Thanks for help.

                    I'm successfully able to set up the clustering environment on a single machine.

                    The only thing that i'm not able to set up is the method of clustering.

                    Is their any way to configure the method it should use,
                    1) Round-Robin,
                    2) First Available, and,
                    3) First AvailableIdenticalAllProxies

                    Thanks in advance.


                    • 7. Re: New to clustering
                      vignesh vignesh Newbie

                      Hi Nitin,

                      mod_jk currently supports only one method of load balancing i.e, weighted round robin. As you may be aware now, the workers.properties configuration file defines the configuration for each node as follows.

                      # Define list of workers that will be used
                      # for mapping requests
                      # Define Node1
                      #worker.node1.local_worker=1 (1)

                      # Define Node2
                      worker.node2.host= node2.mydomain.com
                      #worker.node2.local_worker=1 (1)

                      Here the value for "worker.node1.lbfactor" defines the weightage to be given to the node. For instance if Node1 has 3 and Node2 has 1 for "worker.node1.lbfactor", the round robin ratio would be 3:1, i.e for every 4 requests 3 will go to Node1 and 1 will go to Node2.

                      You may read more about it at


                      • 8. Re: New to clustering
                        Nitin Jain Newbie

                        Thanks for all the help.

                        I'm able to set up clustering and load-balancing and even session replication.

                        But still while replicationg sessions an error is coming on JBoss console (commandline window)

                        17:23:19,747 WARN [InstantSnapshotManager] Failed to replicate sessionID:T+fXOD
                        javax.ejb.EJBException: Exception in setHttpSession: javax.ejb.EJBException: Exc
                        eption in setHttpSession: RuntimeMBeanException: RuntimeException in MBean opera
                        tion 'invoke(org.jboss.invocation.Invocation)'
                        Cause: javax.ejb.EJBException: java.io.NotSerializableException: org.apache.cata
                        at org.jboss.ha.httpsession.server.ClusteredHTTPSessionService.setHttpSe
                        at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        at java.lang.reflect.Method.invoke(Method.java:324)
                        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy39.setHttpSession(Unknown Source)
                        at org.jboss.web.tomcat.session.ClusterManager.storeSession(ClusterManag
                        at org.jboss.web.tomcat.session.InstantSnapshotManager.snapshot(InstantS
                        at org.jboss.web.tomcat.session.ClusteredSessionValve.invoke(ClusteredSe
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
                        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

                        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:19
                        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)

                        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
                        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
                        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
                        at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
                        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
                        at java.lang.Thread.run(Thread.java:534)

                        Can you please provide any help on this?

                        But session in getting replicated properly.


                        • 9. Re: New to clustering
                          vignesh vignesh Newbie

                          Hi Nitin,

                          From the stack trace, it seems like an object that you are adding to the session is not Serializable. Ensure that all objects that need to be in the session are serializable.

                          • 10. Re: New to clustering
                            Nitin Jain Newbie

                            Hi Vignesh,

                            I've verified that all the objects taht i'm adding in session are serializable.

                            But the session is getting replicated properly.

                            Moreover at the the end it is also giving connection timeout reached.

                            I have three nodes.