4 Replies Latest reply on Feb 22, 2012 5:39 AM by Pavel Orehov

    JNDI lookup in JBoss AS 7 in standalone clustered environment

    Pavel Orehov Newbie

      Hi,

       

      We are using Jboss AS 7.1.0.Final in standalone clustered environment.

       

      We have all cluster definitions in standalone.xml file which is passed as parameter to JBoss on startup.

       

      A web module from ear A is invoking an EJB method on ear B (same container, using the global jndi name):

      global/myapp/myejbjar/CommExBean!com.test.CommEx

       

      When both A & B ears are running in the same AS instance, the JNDI lookup works fine.

       

      When A & B ears are running in different AS instances but still on the same machine the lookup fails with error that CommExBean not found.

       

      The bean definition:

      @Stateless

      @Clustered

      @Remote(CommEx.class)

      public class CommExBean  implements CommEx {

      ...

      }

       

      The JNDI lookup:

      Context context = new InitialContext();

      CommEx commEx = (CommEx) context.lookup("global/myapp/myejbjar/CommExBean!com.test.CommEx");

       

      I'm not passing any parameters to Context as assuming that JBoss container should be able to complete all host,port, ... parameters by itself. Fix me if I wrong.

       

      Also tried to look up with java: and ejb: prefixes, with global,module,app,jboss/ecported - nothing helps.

       

      What I'm missing here ?

       

      Thanks,

      Pavel