aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock question about Interfaces and Exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock question about Interfaces and Exceptions" Watch "Mock question about Interfaces and Exceptions" New topic
Author

Mock question about Interfaces and Exceptions

Benoît de Chateauvieux
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
Hi all,

In JavaBeat's site, I found this mock question around exceptions:

3)choose correct statement

1.methods of business interface may throw java.rmi.RemoteException
2.Methods of local and local home interface may throw java.rmi.RemoteException
3.Methods of web service end points interface may throw java.rmi.RemoteException
4.Methods of remote and remote home interface must not throw application exception

The answer is 3 but I think it's 1.
Am I wrong ?


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" !

4 is wrong.

Thanks for your opinion

Beno�t


SCJP5 | SCBCD5 | SCEA5 Part 1
Sven Meys
Greenhorn

Joined: Feb 13, 2008
Posts: 7
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
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
Many thanks, Sven !
Sven Meys
Greenhorn

Joined: Feb 13, 2008
Posts: 7
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Mock question about Interfaces and Exceptions