Handling exceptions

A WebSphere Access EJB provides the following features for handling exceptions:

Logging and tracing

Debugging an enterprise bean is largely dependent on the application server in which the enterprise bean is deployed. A WebSphere Access EJB handles logging and tracing as described in the following sections.

Note:
This section summarizes logging and tracing at a high level. For more detailed information, refer to the documentation for your application server.

Logging

The application server usually handles in its own server-specific manner all log messages that an enterprise bean generates. Usually, you can configure this structure through a console or an application-server deployment descriptor. The WebSphere Access EJB deployment descriptor provides the logFile environment entry to define the location of the log file that this enterprise bean uses.

A WebSphere Access EJB directs log messages based the setting of this environment entry:

  1. The enterprise bean looks for the logFile environment entry and logs all error and trace messages to it.
    Important:
    The default deployment descriptor that WebSphere business integration system provides does not include the logFile environment entry because some application servers automatically reroute all log and trace messages to their own application-server log. If you want to specify a separate log file for an instance of a WebSphere Access EJB, you must add the logFile environment entry before you deploy the Access EJB.
  2. If no logFile environment entry has been specified in the deployment descriptor, the WebSphere Access EJB logs all error and trace messages to standard output (STDOUT).

Tracing

As with logging, the application server usually handles in its own server-specific manner all trace messages that an enterprise bean generates. There is no concept of a trace file for a WebSphere Access EJB. The application server logs all trace messages that the enterprise bean generates in its own server-specific file. The WebSphere Access EJB deployment descriptor provides the traceLevel environment entry to define the amount of trace information desired, as follows:

Exceptions

A WebSphere Access EJB provides support for exception handling. Table 13 shows the types of exceptions that WebSphere Access EJB handles.

Table 13. Types of EJB exceptions

Kind of exception Description Handled by
Application exception
An exception that is thrown by a method of the WebSphere Access EJB home or remote interface An application exception does not result in the removal of the WebSphere Access EJB instance. Client component
System exception
An exception not meant to be surfaced to the client component Application server

Table 14 lists the application exceptions that a WebSphere Access EJB can generate. The client component should check for these application exceptions.

Table 14. Application exceptions

Application exception Description
CreateException


Thrown by a WebSphere Access EJB to indicate an application exception has occurred in a create() method.
RemoveException


Thrown by a WebSphere Access EJB to indicate an application exception has occurred in a remove() method.
CollaborationExecutionException


Thrown by a WebSphere Access EJB to indicate that the collaboration execution has encountered an error, such as:
  • data format conversions
  • an attempt to execute the collaboration when the session bean is not configured to communicate with the specific ICS instance
RemoteException


Thrown by a method of the remote and home interfaces of a WebSphere Access EJB to indicate that it has encountered an error in the way that the method was invoked. Because the remote and home interfaces of a WebSphere Access EJB are Remote Method Invocation (RMI) interfaces, all their methods throw the RemoteException exception or one of its subclasses. The application server or EJB container might throw a RemoteException subclass to provide additional information.

The exceptions in Table 13 are derived from the Exception class. A CollaborationExecutionException provides the following information:

Copyright IBM Corp. 1997, 2004