The following explains this behavior in detail:
The setUncheckedException wraps the NullPointerException in an
UncheckedException with full information in the super base class Throwable
and throws the exception from the EJSDeployedSupport() immediately;
therefore, the newRemoteException() is not reached.
public void MyMethod() throws java.rmi.RemoteException {
EJSDeployedSupport _EJS_s = new EJSDeployedSupport();
try {
testpackage.TestBean beanRef = (testpackage.TestBean)container.
Invoke(this, 0, _EJS_s);
}
catch (java.rmi.RemoteException ex) {
_EJS_s.setUncheckedException(ex);
}
catch (Throwable ex) {
beanRef.MyMethod();
}
catch (java.rmi.RemoteException ex) {
_EJS_s.setUncheckedException(ex);
}
catch (Throwable ex) {
_EJS_s.setUncheckedException(ex);
throw new RemoteException("bean method raised unchecked
exception", ex);
}
finally {
container.postInvoke(this, 0, _EJS_s);
}
return ;
}
Afterward, the EJB Container performs the postInvoke process and return
from the MyMethod() call with an UncheckedExcpetion(NullPointerException).
The tie on the server side (_EJSRemoteStatelessTest_Tie) catches the
UncheckedException in the Throwable clause and wraps the
UncheckedException to the "org.omg.CORBA.portable.UnknownException".
This is the default semantics for CORBA compliance so the method can be
called between Java™, C++, or other CORBA compliant service. At this time
the call stack is stripped from the exception and not sent back to the
client by the orb. The CORBA specification allows only a string to be
passed, but not the full Java exception stack.
public org.omg.CORBA.portable.OutputStream _invoke(String method,
org.omg.CORBA.portable.InputStream _in, org.omg.CORBA.portable.
ResponseHandler reply) throws
org.omg.CORBA.SystemException {
try {
...
case 8:
if (method.equals("MyMethod")) {
target.MyMethod();
org.omg.CORBA.portable.OutputStream out =
reply.
return out;
}
...
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
The EJB container has already passed the full exception to the ORB, but is
removed due to CORBA compliant implementation. |