The CORBA specification defines the list of standard system exceptions.
In Java, all CORBA system exceptions extend org.omg.CORBA.SystemException. System exceptions are unchecked exceptions (they extend java.lang.RuntimeException). The Java compiler does not require that you catch CORBA system exceptions. However, some exceptions can occur in a well-behaved program. For example, the Session.loookup call throws a NO_PERMISSION exception when you request a component instance and the user lacks permission to instantiate that component. You may want to trap the exceptions shown in the code fragment below:
try { // invoke method(s) ... } catch (org.omg.CORBA.COMM_FAILURE cf) { // If this occurs when instantiating a Manager // instance, the server is likely down or has run // out of connections. You can retry the connection // if desired. // // If this occurs after a method call, you // can retry the call (or the transaction call // sequence for a stateful component). ... } catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK tr) { // A component on the server aborted the EAServer // transaction, or the transaction timed out. // Retry the method call(s) if desired. ... } catch (org.omg.CORBA.OBJECT_NOT_EXIST one) { // Possibly try to create another instance. Check // that the package and component are installed // on the server. // Received when trying to instantiate a component // that does not exist. Also received when invoking // a method if the object reference has expired // (this can happen if the component is stateful // and is configured with a finite Instance Timeout // property). Create another instance if desired. ... } catch (org.omg.CORBA.NO_PERMISSSION np) { // Tell the user they are not authorized ... }}
catch (org.omg.CORBA.SystemException se) { // Catch-all clause for any CORBA system exception // that was not explicitly caught above. // Report the error but don’t bother retrying. ...
Not all of the possible system exceptions are shown
in the example. See the CORBA/IIOP 2.3 specification for
a list of all the possible exceptions. You can download the specification
from the OMG Web site.
In C++, all CORBA system exceptions are mapped to a C++ class that is derived from the standard SystemException class defined in the CORBA module. You may want to trap the exceptions shown in this code fragment:
try { ... // invoke methods } catch (CORBA::COMM_FAILURE& cf) { ... // A component aborted the EAServer transaction, // or the transaction timed out. Retry the // transaction if desired. } catch (CORBA::TRANSACTION_ROLLEDBACK& tr) { ... // possibly retry the transaction } catch (CORBA::OBJECT_NOT_EXIST& one) { ... // Received when trying to instantiate // a component that does not exist. Also // received when invoking a method if the // object reference has expired // (this can happen if the component // is stateful and is configured with // a finite Instance Timeout property). // Create a new proxy instance if desired.} } catch (CORBA::NO_PERMISSSION& np) { ... // tell the user they are not authorized } catch (CORBA::SystemException& se) { ... // report the error but don’t bother retrying }
Not all of the possible system exceptions are shown
in the example. See the CORBA/IIOP 2.2 specification (formal/98-02-01)
for a list of all the possible exceptions.