2 Replies Latest reply on Dec 6, 2002 12:17 PM by Jaksa Vuckovic

    SFSB state replication

    Jaksa Vuckovic Newbie

      I'm Having some problems in making SFSB clustering work. I'm using the 3.0.3 version in the "all" configuration. I have two JBoss instances running on 2 machines. The instances are able to see eachother.
      I have implemented a SFSB called counter which has 2 methods increase() and getValue(). I access this bean from a java client via RMI which calls the increase method 1000 times.
      I deployed the bean on both servers and I have configured the bean-load-balance-policy to RoundRobin.
      The call redirection seems to work fine, but state does not get transfered. In other words I get 499 calls on one server and 501 on the other but both the counters show the values 499 and 501 instead of 1000. Is it supposed to work this way or do I have to configure the server to do Stateful Bean Replication? Or maybe I did something wrong when implementing the bean. I have modified the jboss.xml deployment descriptor, do I have to specify somewhere else that the bean is clustered?


      Here you are some snippets of the code:




      public class CounterBean implements SessionBean {
      public int value;

      public int getValue() { return this.value; }

      public void increase() {
      System.out.println("counter: " + this.value);

      public void ejbCreate() { this.value = 0; }
      public void ejbActivate() {}
      public void ejbPassivate() {}
      public void ejbRemove() {}
      public void setSessionContext(SessionContext parm1) {}

      InitialContext ctx = new InitialContext();
      Object objref = ctx.lookup("ejb/clustered/Counter");
      CounterHome counterHome = (CounterHome)PortableRemoteObject.narrow(objref, CounterHome.class);

      // create the bean
      Counter counter = counterHome.create();

      // invoke some methods
      for (int i=0; i<1000; i++) {