Errors occurring during component execution should be handled gracefully as follows:
Write detailed descriptions of the error to the log. This will help you debug the problem later. You can call any of the System.out.print methods to write to the log (the output is redirected).
If the error prevents completion of the current transaction, roll it back as described in “Set transactional state”.
Throw an exception with a brief, descriptive message that is appropriate for display to an end user of the client application.
Java components can record errors or status messages to the server’s log file. Writing to the log creates a permanent record of the error, and log messages can be automatically stamped with the date and time that the message was written. Call any of the System.out.print methods to write to the log.
You can also throw an uncaught exception. Ideally, any exception thrown by your component should be a standard CORBA IDL exception or a user-defined IDL exception (the latter must be listed in the raises clause of the IDL method definition and the throws clause of the equivalent Java method declaration). All exceptions are forwarded to the client, but only exceptions that are defined in IDL can be rethrown by the client stub as a duplicate of the server-side exception. CORBA ORB and EAServer EJB clients receive forwarded exceptions differently:
CORBA ORB clients rethrow any exception that is defined in IDL as a duplicate of the original exception. Other exceptions are rethrown as the standard CORBA exception UNKNOWN.
EAServer EJB clients rethrow any server exception as a JException instance with the message text returned by calling toString() on the original exception.
Copyright © 2005. Sybase Inc. All rights reserved. |