3 Replies Latest reply on Jan 17, 2003 11:48 AM by Sacha Labourey

    JNDI vs. HA-JNDI - What am I doing wrong?

    joe greenwood Newbie

      Okay, after reading both the AdminDevel docs and the clustering docs I have gotten this far...

      I have a clustered SLSB which get's kicked off in round robin fashion by a set of MDB's on one of the nodes. There is a timed MBean which invokes the process that ultimately sends JMS messages, to which the MDB's pick up and do a cluster lookup for the SLSB. This works in a round robin fashion nicely.

      I have another MBean which loads a config file, binds a Properties object to the HA-JNDI port 1100 like so:

      public static InitialContext getClusterContext() throws NamingException {
      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 ctx = new InitialContext(p);
      return ctx;
      } //

      getClusterContext().rebind(name, myProperties);

      now, should I not be able to from a different node perform a lookup like so:

      getClusterContext().lookup(name); ????

      As the cluster-wide context should find the object immediately bound to itself and not look in local JNDI's across cluster nodes?

      To demonstrate what is going on, I use this code:

      try {
      // let's read it.
      InitialContext cCtx = JNDINames.getClusterContext();
      NamingEnumeration enum = cCtx.listBindings(name);
      while ( enum.hasMore() ) {
      Binding names = (Binding) enum.next();
      log.info("bound : "+names.getName());
      } // end while
      }catch (Exception ignore) {};

      And when this code executes on a differnt node in the cluster it never shows my object bound to the JNDI. However, on the node with the MBean deployed (or the node that intially bound the object) it's there?

      No matter what configuration I use (initially bind to local JNDI, and still lookup over HA-JNDI) I cannot get the cluster node to recognize.

      Do I really have to set my PROVIDER_URL to contain a whole list of nodes:1100 to perform this lookup?

      Thanks,
      Joe