1 Reply Latest reply on May 18, 2007 1:16 PM by alrubinger

    JNDI lookup from app server of ejb in another server returns

    justinmiller

      Hi,

      I have two application servers and we're using EJB3 style stateless session beans. I intentionally want to lookup from one app server, a remote EJB from the other. I attempt to do this as follows:

      Properties props = ...
      props.put(InitialContext.PROVIDER_URL, "otherAppServer:1099");

      InitialContext ctx = new InitialContext(props);

      remoteEJB = ctx.lookup(EJB_NAME);

      The problem is, nothing fails! I can successfully create the initial context. However, when I the lookup happens, instead of returning a remote reference to the EJB in the other app server, it gives me back a local reference!

      From the googling I've done, I don't think this is a bug necessarily, but more of a "feature" of jndi/jboss. My guess is that's it's the IsLocalInterceptor that's making this judgement call.

      Is there a way to disable this optimization for certain session beans? What's the best way to accomplish what I'm after?

      I'm using jboss 4.0.4 and EJB3.

      If this is not an EJB issue and there is a better forum to post this in, please let me know

      Thanks in advance,
      Justin