Setting the system property to enable remote EJB clients to receive nested or root-cause exceptions

You might want to code your application to perform a given action if a certain kind of exception is the root-cause of a failure and is nested within the exception that you receive. The default behavior in the product might mask a nested or root-cause exception in your application.

About this task

The Enterprise JavaBeans (EJB) container creates a TransactionRolledbackException exception for a remote client when it can create a RemoteException exception instead. With the RemoteException exception, the container does not lose the ability to have root-cause information nested inside the exception.

You can set the following Java virtual machine (JVM) system property to true through the administrative console for the product: com.ibm.websphere.ejbcontainer.includeRootExceptionOnRollback This change enables the remote client to receive nested exceptions when a rollback occurs.

Note: This property is applicable only for scenarios where the transaction in which the bean method is running was started by the container for this specific method invocation. All of the other scenarios must result in a TransactionRollBackException exception according to the EJB specification.

Procedure

  1. Open the administrative console.
  2. Select Servers.
  3. Select Servers > Application servers > server_name.
  4. Under Server infrastructure, select Java and Process Management > Process Definition.
  5. Under Additional properties, select Java virtual machine > Custom properties > New.
  6. In the Name entry field, type com.ibm.websphere.ejbcontainer.includeRootExceptionOnRollback.
  7. In the Value entry field, type true.
  8. Select OK.