0 Replies Latest reply on Dec 16, 2014 1:02 PM by tibu

    Custom cluster-wide JNDI bindings

    tibu Newbie



      We would like to bind a bean with a name containing the node name in the jndi context and be able to access it from any other cluster nodes via jndi lookup.

      From my understanding, our goal should be to bind it in java:jboss oder java:jboss/exported, because these namespaces are shared amongst cluster nodes.


      We were hoping it would work like this:


      // Bind it in @Startup @PostConstruct method:

      String node = System.getProperty("jboss.node.name");

      new InitialContext().bind("java:jboss/someName" + node, this);


      // Lookup somewhere in another EJB on another cluster node

      String node = <...>

      InitialContext.doLookup("java:jboss/someName" + node);


      Unfortunately this fails with a NameNotFoundException. How would be the right way to do something like this?

      Would the distinct name be a better solution for this? Is it possible to give every bean the node name as distinct name?

      It would be great if we could solve this progammatically or with just minimal changes in the config files.


      Thanks for reading,