EJB design: urgent ! Is RemoteException deprecated
- Posted by: Srin Reddy
- Posted on: February 27 2002 09:37 EST
I came to know that java.rmi.RemoteException is deprecated
Please let me know it is correct or not
Also I will be thankfull if any one provide article on this.
Also let me know the alternative for this
B Srinivas Reddy
RemoteException is not deprecated. One of its uses in the EJB framework has been deprecated since EJB 1.1. I suspect that's what you ment. As of EJB 1.1, RemoteExceptions should not be thrown by a bean developer to indicate a system exception, as in EJB 1.0. You should throw a RuntimeException, possibly EJBException, instead. This doesn't mean clients won't get a RemoteException when a system exception is thrown - it only means that the bean developer shouldn't signal a system exception to the container using RemoteException.
Actually, I believe one of the key reasons for deprecating this use of RemoteException is that it created vauge and comfusing semanitcs. You would throw a RemoteException to the container, and it would throw a different exception to the client - not the one you gave it. There was a complete discussion in TSS on why this is the case. I can look it up if anyone is interested.
Thanks for your reply.
Can U pls give some details on - complete discussion in TSS.
Here it is: http://www.theserverside.com/discussion/thread.jsp?thread_id=11507
The latter part of the discussion revolves around the question: "can a compliant EJB server hand system exceptions to clients?". The focus of the discussion was about EJBExceptions, not RemoteExceptions. So we are actually asking "can a compliant EJB server wrap the EJBException inside the RemoteException it passes to the client?". However, the discussion still applies in the RemoteException case as well, because the remote exception can be of some server-specific subclass, or contain a "wrapped" server-specific exception. This should become clear after you read the discussion thread I listed above. If there are still any unclear points feel free to ask.