2 Replies Latest reply on Jun 15, 2006 12:00 PM by Vandenabeele Alexandre

    Problem with cluster JNDI lookups in JBoss 4.0.2

    Vandenabeele Alexandre Newbie

      Hi,

      I have a problem with cluster (HA) JNDI lookups in JBoss 4.0.2.

      I have several clusters hosted on the same machine.
      Each JBoss server deploy an EJB with the JNDI name : $JNDIName.
      The HA JNDI port and the NamingService port are different for each server

      On another machine , i can lookup the EJB with this code :

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "jnp://$HOSTNAME:$PORT");
      InitialContext initialContext = new InitialContext(env);
      EJBHome home = (EJBHome) PortableRemoteObject.narrow(initialContext.lookup($JNDIName), theHomeClass);



      The problem appears when the Jboss server (port $PORT) is down.
      The first lookup doesn't work. I am getting an Exception and if I try to lookup a second time,
      the lookup will return the EJB deployed on an other JBoss server.
      And yet the other server is not in the first cluster.
      The next lookups will return an EJB of a server randomly.

      ($PORT can be the JNDI naming service port or the HA JNDI port. Tested for both ports)

      I do not understand why I reach the other JBoss servers if they are not in the cluster (defined by the PROVIDER_URL ).

      It is as if variable PROVIDER_URL were not used.

      Can you please help?

      Thanks,

      Alexandre