Forums Register Login

Understanding Exception

+Pie Number of slices to send: Send
In FHEJB p543, it said

If your business logic catches an exception which the client is not expecting, wrap it and rethrow it as an EJBException.


My question is that it depends on the client is remote or local, if it is local client, yes, rethrow it as an EJBException. But if it is a remote client, I think it should be wrapped and rethrown as an RemoteException.
Correct me if I am wrong
[ April 18, 2004: Message edited by: Alibabra Sanjie ]
+Pie Number of slices to send: Send
Alibabra,
Your bean methods should never throw a RemoteException, even though they may declare that RemoteExceptions can be thrown. It's the container's job to throw RemoteExceptions. If you throw an EJBException (like you should), the container will wrap it into a RemoteException for you if the client is remote.
To illustrate this, consider the fact that you have no way of knowing whether the client is remote or local (unless of course you only expose one of those component interfaces and can make the assuption).
+Pie Number of slices to send: Send
Your bean class should never declare or throw RemoteExceptions. Remember bean class is not a remote object. It can only throw application exceptions or runtime exceptions (EJBException).
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 580 times.
Similar Threads
HF Exception doubt
EJBException and RemoteException
What Exception if database down
Exceptions
Throw EJBException for Local only or for both Local and Remote?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:59:10.