2 Replies Latest reply on Mar 6, 2005 11:47 PM by sand_pu

    EJB Clustering Blues

    sand_pu

      Hi Forum,

      This has been bugging me for days. I have Jboss servers running on two Win2k machines in the clustered configuration. I have a simple session bean deployed in the farm directory. I'm able to look up the bean's home and remote interfaces. I've specified round robin balancing policy in the jboss.xml file. However, the bean in only one machine is accessed. (No signs of round-robin). Here is how I look up the bean in the client (a servlet):

      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, null); // HA-JNDI port.
      p.setProperty("provider_url","");
      p.setProperty("jnp.partitionName","DefaultPartition");
      p.setProperty("jnp.discoveryGroup","230.0.0.4");
      p.setProperty("jnp.discoveryPort","230.0.0.4:1102");
      InitialContext ctx = new InitialContext(p);
      Object objref = ctx.lookup("CalcBean");
      homecalc = (CalcHome)PortableRemoteObject.narrow(objref, CalcHome.class);

      What could be the problem. Looking forward to an answer.

      Thanks in Advance,

      Santosh

        • 1. Re: EJB Clustering Blues

          Santosh;

          Make sure you are reusing the same remote created by the home object to make the calls. Once a new remote is created, the round robin is reset so if you keep creating a new one one (or getting a new home) on every call, you will always see the same server be called.

          //Nicholas

          • 2. Re: EJB Clustering Blues
            sand_pu

            Hi Nicholas,

            Thanks for your reply. At your suggestion I tried to Look up the Home and remote interfaces only once (in the init() method of the servlet), and still no luck. Guess somethings wrong with the configuration.

            Thanks,

            Santosh