2 Replies Latest reply on Mar 6, 2006 1:35 PM by lkral

    org.jboss.naming.NamingContextFactory

    lkral

      According to [JBAS-1620], we have to use org.jboss.naming.NamingContextFactory to allow the handle to remember the JNDI environment that was in effect when it was created.

      So when a handle is created with SessionContext.getEJBObject().getHandle() in the JBoss JVM and is later serialized to the client JVM, then the default/conf/jndi.properties has to be altered like this:

      java.naming.factory.initial=org.jboss.naming.NamingContextFactory
      java.naming.provider.url=localhost:1099


      But when I add these lines, I get the following warning while starting the container:

      09:55:58,126 WARN [NamingService] Context.PROVIDER_URL in server jndi.properties, url=localhost:1099


      Can someone please clarify this situation?



      Cheers,
      Lars

        • 1. Re: org.jboss.naming.NamingContextFactory
          starksm64

          It is the client that needs to use the org.jboss.naming.NamingContextFactory, not the server jndi.properties.

          • 2. Re: org.jboss.naming.NamingContextFactory
            lkral

            Thanks for your reply, but as far as I can see the naming properties are cached inside the StatefulHandleImpl at construction-time. So when I call SessionContext.getEJBObject().getHandle() the handle gets constructed inside the server JVM. And these properties are still in use when this handle instance is serialized into the client JVM.

            To confirm this in a test environment I switched to the org.jboss.naming.NamingContextFactory on the client side and called
            NamingContextFactory.lastInitialContextEnv.get() to get sure the naming properties are cached properly. But even though Handle.getEJBObject() results in the following exception:

            java.rmi.RemoteException: Error during getEJBObject; nested exception is:
            javax.naming.NameNotFoundException: Name MyBean is not bound in this Context

            Only after I changed default/conf/jndi.properties in my JBoss installation directory, the handle worked as expected.



            Regards,
            Lars