1 Reply Latest reply on Mar 10, 2010 1:38 PM by Brian Stansberry

    EJB load balancing not working

    Loreno Oliveira Newbie

      Hi there,


      I have been fighting with the configuration of my application / jboss cluster, attempting to see the load balancing of EJB calls working. However, I couldn't put it to work so far.


      My scenario is:


      I have a three-tier application deployed in the farm directory of the master JBoss. The application is transferred to the second node of my cluster and I can run it on both nodes individually (pointing my browser to the correct IP). There aren't any error or warning messages in the outputs of the JBoss on both nodes.


      As my application is JSF-based, I'm performing EJB lookups from my backing bean using the following code:


      Properties p = new Properties();


      p.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );

      p.put( Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces" );

      p.put( Context.PROVIDER_URL, "localhost:1100" ); // HA-JNDI port.

      InitialContext initialContext = new InitialContext( p );


      this.conhecimentoFacade = (ConhecimentoFacade)initialContext.lookup( jbossJndiName );


      The returned proxy for "conhecimentoFacade" is an instance of StatelessClusteredProxy. The load balancing policy is RandomRobin and the name of the cluster partition is correct.


      However, all the calls to methods of conhecimentoFacade are always forwared to the EJB deployed in the same node as the one the baking bean is running.


      My doubt: shouldn't the calls be balanced between the two instances of the EJB present in my cluster (one on each host)? Im I making something wrong?