Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.5.0) Part Number E13981-01 |
|
|
View PDF |
This section describes the following:
Recovering From a NamingException While Accessing a Remote Enterprise Bean
Recovering From a NullPointerException While Accessing a Remote Enterprise Bean
If you are trying to remotely access an enterprise bean 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 enterprise bean from a remote object or remote servlet.
When accessing a remote enterprise bean 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 enterprise bean 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 later Context context = new InitialContext (env);
See "Load Balancing" for more information on dedicated.rmicontext.