0 Replies Latest reply on Sep 15, 2011 5:32 AM by Fabrizio Benedetti

    Remote EJB lookup on Weblogic server

    Fabrizio Benedetti Novice

      A collegue of mine asked me if it is possible to migrate a webapp from AS6 to AS7.


      This webapp, among other things, has a servlet that makes a call to a remote EJB running on Weblogic 9.2 (!). The war has all the jars in WEB-INF/lib (weblogic.jar and client jar).

      It works fine on 6.1.0.Final.


      I know that 7.0.1 does not yet support remote EJB and remote JNDI client, but something strange happens: once deployed, the lookup works fine, but the returned object is null. Here is the code:


      Hashtable env = new Hashtable();

      env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

      env.put(Context.PROVIDER_URL, "t3://remote-host:7001");

      Context ctx = new InitialContext(env);

      Object obj = ctx.lookup("com.foo.bar.MyBean");

      // obj is null!


      I tried to set a wrong jndi name and the exception is correct (javax.naming.NameNotFoundException), so the lookup seems to work fine.


      Why the returned object is null?


      Is it a side effect of the lack of remote JNDI client support of 7.0.1?

      Will it work on 7.1.0?