| Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
This section describes:
Recovering From a NamingException While Accessing a Remote EJB
Recovering From a NullPointerException While Accessing a Remote EJB
If you are trying to remotely access an EJB and you receive an javax.naming.NamingException error, your JNDI properties are probably not initialized properly. See "Load Balancing" for a discussion on setting up JNDI properties when accessing an EJB from a remote object or remote servlet.
When accessing a remote EJB from a Web application, you receive the following error: "java.lang.NullPointerException: domain was null ". In this case, you must set an environment property in your client while accessing the EJB set dedicated.rmicontext to true.
The following demonstrates how to use this additional environment property:
Hashtable env = new Hashtable( );
env.put (Context.INITIAL_CONTEXT_FACTORY,
"oracle.j2ee.rmi.RMIInitialContextFactory");
env.put (Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put (Context.SECURITY_CREDENTIALS, "oc4jadmin");
env.put (Context.PROVIDER_URL, "ormi://myhost-us/ejbsamples");
env.put ("dedicated.rmicontext", "true"); // for 9.0.2.1 and above
Context context = new InitialContext (env);
See "Load Balancing" for more information on dedicated.rmicontext.