Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Handling Exceptions

This section describes:

- Recovering From a NamingException While Accessing a Remote EJB

- Recovering From a NullPointerException While Accessing a Remote EJB

- Recovering From Deadlock Conditions

## Recovering From a NamingException 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.

## Recovering From a NullPointerException While Accessing a Remote EJB

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.`

## Recovering From Deadlock Conditions

If the call sequence of several beans cause a deadlock scenario, OC4J notices the deadlock condition and throws a `Remote` exception that details the deadlock condition in one of the offending beans.