2 Replies Latest reply on Mar 18, 2011 6:05 AM by andrey.vorobiev

    Remote EJB lookup problem

    andrey.vorobiev

      Hi, guys.

       

      We have two application servers:

      1. JBoss AS version 6 (Final)
      2. Mobicents (based on JBoss 5.1.0.GA)

       

      Also we have session stateless bean deployed on Mobicents defined as follows:

       

      @Remote

      public interface Test

      {

      }

       

      @TransactionAttribute(value = TransactionAttributeType.REQUIRED)

      @Stateless(name = "TestBean", mappedName = "ejb/test.Test")

      public class TestBean implements Test

      {

      }

       

      And then we are trying to lookup this bean from JBoss AS (6) using following code:

      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      env.put(Context.PROVIDER_URL, "jnp://" + host + ":" + port);
      
      InitialContext context = new InitialContext(env);
      context.lookup("ejb/test.Test");
      
      
      

       

      As a result we get on Jboss 6 side:

      Caused by: javax.ejb.EJBTransactionRolledbackException: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Exception while trying to locate proxy factory in JNDI, at key ProxyFactory/sip-srv-ear/TestBean/ejb/test.Test]
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:148) [:0.0.1]
      ....
      Caused by: java.lang.RuntimeException: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Exception while trying to locate proxy factory in JNDI, at key ProxyFactory/sip-srv-ear/TestBean/ejb/test.Test]
      at TestJndi.jndiLookup(TestJndi.java:87) [:]
      ...
      Caused by: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Exception while trying to locate proxy factory in JNDI, at key ProxyFactory/sip-srv-ear/TestBean/ejb/test.Test]
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508) [:5.0.5.Final]
      ...
      Caused by: java.lang.RuntimeException: Exception while trying to locate proxy factory in JNDI, at key ProxyFactory/sip-srv-ear/TestBean/ejb/test.Test
      at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getProxyFactoryFromJNDI(ProxyObjectFactory.java:249) [:1.0.11]
      ...
      Caused by: javax.naming.NameNotFoundException: ProxyFactory not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
      

       

      Note that we have ProxyFactory bound at the root of the jbdi tree on Jboss 6 side but no such binding on Mobicents.

      Also note that jndi tree on Mobicents side contains

      sip-srv-ear/TestBean/remote-test.Test and it is "Proxy for: test.Test" (this was found by manually traversing jndi tree), but this name leads to the original one and ends with same exception.

       

      Is it an excpected behaviour that we cann't lookup beans between different versions of JBoss?