CORBA system exceptions in Java

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. 
   ... 

The example does not show all of the possible system exceptions. See the CORBA/IIOP 2.3 specification for a list of all the possible exceptions.