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.
For me, 1 is OK because the spec says (4.6.6) "The remote business interface is not required or expected to be a java.rmi.Remote interface. The throws clause should not include the java.rmi.RemoteException. The methods of the business interface may only throw the java.rmi.RemoteException if the interface extends java.rmi.Remote."
2 is wrong.
3 is wrong too because the spec says (4.6.11) "This means that their argument and return values must be of valid types for JAX-RPC, and their throws clauses must include the java.rmi.RemoteException. The throws clause may additionally include application exceptions." It doesn't say "may" but "must" !
Methods of the "Remote" Business interface may throw a RemoteException indeed. But the question does not state whether it is remote or Local. Local interfaces may never ever ever ever declare RemoteExceptions. If you try doing it the container will crash by laughing at you.
Benoît de Chateauvieux
Joined: Aug 10, 2007
Many thanks, Sven !
Joined: Feb 13, 2008
Well it just seems logic to me. I'm currently learing for the EJB 2 exam but I doubt the whole logic behind local-> ejbException remote-> RemoteException has changed in ejb3.