Server Access for J2EE provides the following features for handling exceptions:
Server Access for J2EE implements necessary error and tracing interfaces.
In a managed environment, the application server handles all messages that the WebSphere Access Resource Adapter generates in its own server-specific manner. Usually, you can configure this structure through a console or a deployment descriptor.
Debugging a resource adapter is largely dependent on the application server in which the resource adapter is deployed. An Access Resource Adapter handles logging and tracing as follows:
An Access Resource Adapter does not use the logging facilities provided in the WebSphere business integration system connector infrastructure. Instead, the resource adapter uses the logging and tracing services that the application server provides. Therefore, there is no concept of a message file for an Access Resource Adapter. The application server logs all messages that the resource adapter generates in its own server-specific manner. Usually, you can configure this structure through a console or a deployment descriptor. For more information, refer to the documentation for your application server.
As with logging, the Access Resource Adapter uses the tracing services that the application server provides. Therefore, there is no concept of a trace level for an Access Resource Adapter. The application server can support tracing for connection management, as Server Access for J2EE does implement necessary error and tracing interfaces.
In a non-managed environment, the client application that calls the WebSphere Access Resource Adapter must handle all error logging and tracing.
Server Access for J2EE provides support for exception handling. An
application component checks for exceptions that the InterChange Server
connection generates through the CCI classes shown in Table 18.
Table 18. CCI classes for exception handling
Table 19 shows the types of exceptions that an Access Resource
Adapter throws.
Table 19. Types of ResourceException Exceptions
The exceptions in Table 19 are derived from ResourceException, which extends Exception. A ResourceException provides the following information:
This string is a standard Java exception message and is available through the getMessage() method.
This error code identifies the error condition that the ResourceException instance represents.
Often a ResourceException results from a problem at a lower level. If appropriate, a lower-level exception might be linked to a ResourceException instance. This lower-level exception is a java.lang.Exception or any derived exception type. For example, an exception thrown by any method of the Server Access Interface is propagated as an ApplicationException, which is linked to a ResourceException.
Nearly all CCI methods throw a ResourceException if an error occurs. The application component should catch the ResourceException and take appropriate recovery action. Only methods in the CwInteractionSpec interface do not throw a ResourceException. Instead, the set methods in this interface throw the PropertyVetoException exception.