users@jax-rpc.java.net

getCause() from java.rmi.RemoteException

From: John L. Fjellstad <john_at_PRODEXNET.COM>
Date: Wed, 06 Nov 2002 12:02:01 -0800

On my server side, I throw a RemoteException() when an exception occurs
for som reason, like this:

throw new RemoteException( "This is an exception", myException );

On the client side, I try to catch the exception like this:

try {

} catch( RemoteException ex ) {
      if ( ex.getCause() instanceOf myException ) {
          throw (myException)ex.getCause();
      } ...
}

But when I check the return value of getCause() it is null. Apparently,
my "cause" was not serialized (although I do see the message). Am I
doing anything wrong?

Basically, what I want to do is that my application receives the same
exception whether it sits locally or goes through the web services.

Thanks,
--
John L. Fjellstad,  Software Engineer