Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exceptions in bean getting converted to Remote

Status
Not open for further replies.

BillyKrow

Programmer
Aug 27, 2001
67
0
0
US
I have a session bean that is throwing a specific type of exception that I have created. I verified that it is throwing the correct exception in the bean itself, however when I call the method using the remote(component) interface the exception gets converted to a remote exception. Even stranger, when I call the method from a servlet everything works fine. It's only when I call the method from another session bean do I see this problem. Any ideas?
 
I didn't work with Beans, remote exceptions and servlets, but it's a normal way to encapsle an exception in a kind of framework.
You catch it, and wrap it in your own ExceptionChild. This ExceptionChild is well known in your Classes while foreign Exceptions aren't.
This isn't problematicall, because normally there is only an additional level for the StackTrace, and Exceptions stay primitiv over lot of inheritance levels.

dont't visit my homepage:
 
Remember that EJB is uses RMI as the transport level. So when you call the method from your servlet, this is within the J2EE container - and is thus less prone to java.rmi.RemoteException (because if your container is decent, it won't actually invoke RMI to transport the data because there is no need as the servlet and the EJB are running in the same JVM - incidentally this is one reason why Local EJBs were introduced explicitly in EJB spec 2.0 because many conatiners were doing this covertly anyway to reduce processing time).

Now, I expect that your method may well throw, or catch your MyException exception - but this is not being thrown - on the RMI level (so below the EJB abstraction), an exception is being thrown - which is bypassing your catch/throw statement.


 
Sedj, I agree with what you are saying that the remote exception is being thrown at the rmi level it's just that I can not figure out why. Also note that the bean and the caller are on the same JVM. I even tried using a EJBLocalHome interface for the heck of it but had the same problem. Aslo note that this is running on a WebLogic server.
 
Addendum to above. To avoid confusion, the problem I was having using the EJBLocalHome interace was unrelated to the original problem of losing my exception. Aslo note that although the exception gets converted to remote, my original exception is still wrapped within the remote which can easily be seen by calling the getMessage method.
 
Post the exception stack trace and (relevent - not all) code ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top