This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 ]