This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, guys, I cannot understand, since component interface has already declare the RemoteException, why the business method of the bean class, which implements the component interface, cannot declare the RemoteException?
A RemoteException should be used to indicate a network error, or something to that effect. Since your bean just implements business logic, it shouldn't be doing anything with RemoteExceptions. In addition, you don't know whether it will be a local or remote client anyways. If you need to throw an exception, wrap it in an EJBException and leave it at that.
As you mentioned, there's no reason why you couldn't throw a RemoteException, and the container probably wouldn't even notice if you did. But, the spec says don't do it --- so don't.
Oh -- and the bean doesn't implement the component interface. That's a no-no. Don't do that either -- even though technically you could. [ July 11, 2004: Message edited by: Nathaniel Stoddard ]