Is there a way to get the original exception object from inside a nested or wrapped Exception (for example an EJBException or RemoteException)

Absolutely yes, but the way to do that depends on the Exception, since there are no standards for that. Some examples: ·When you have an javax.ejb.EJBException, you can use the getCausedByException() that returns a java.lang.Exception. ·A java.rmi.RemoteException there is a public field called detail of type java.lang.Throwable ·With a java.sql.SQLException you need to use the method getNextException() to get the chained java.sql.SQLException. ·When you have an java.lang.reflect.InvocationtargetException, you can get the thrown target java.lang.Throwable using the getTargetException() method.

Showing Answers 1 - 1 of 1 Answers

manoj b raut

  • Oct 26th, 2005
 

100% depends upon the mode of execution .

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions