0 Replies Latest reply on Aug 26, 2008 11:28 AM by wurzelkuchen

    strange behaivor of nonclustered ejb calling clustered ejb

    wurzelkuchen

      Hello,

      during my work on a student research project, I noticed a strage behavior.
      Following scenario:

      EJB1: a not clustered stateless EJB, which calls EJB2 per lookup

      @Stateless
      public class Bean implements BeanLocal, BeanRemote {
       ...
       private Bean2 bean2;
       public void call(){
       Properties properties = new Properties();
       properties.put("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
       properties.put("java.naming.factory.url.pkgs",
       "org.jboss.naming:org.jnp.interfaces");
       properties.put("java.naming.provider.url",
       "192.168.0.52:1100");
       Context context;
       try {
       context = new InitialContext(properties);
       bean2 = (RemoteBean2) context.lookup(Bean2.RemoteJNDIName);
       while(...){
       bean2.doSomething();
       }
       } catch (NamingException e) {
       e.printStackTrace();
       }
       }
      



      EJB2: a simple clustered stateless EJB
      @Clustered
      @Stateless
      public class Bean2 implements BeanLocal2, BeanRemote2 {
       ...
       public void doSomwthing(){
       ...
       }
      }
      


      So, if I start these Beans like above, Bean2 starts only on one node of my Cluster. If I use port 1099 (normal JNDI instead of HAJNDI), Bean2 starts on different nodes each time I start bean2.doSomething().
      I realy don't undestand this behaivior. Why does the use of HA-JNDI lets the bean2 unclustered while the use of JNDI leads to a clustered behaivior? I would understand if HAJNDI leads to a clustered and JNDI to an unclustered behaivior, but the opposite happens.
      Does anybody have got a good explanation or at least an idea why?

      Best Regards