Which of the following is True about business interface of an EJB 3.0 bean? (Choose two) (Choose 2)
[A] The interface must not extend javax.ejb.EJBObject or javax.ejb.EJBLocalObject interfaces.
[B] The remote business interface must implement the java.rmi.Remote interface.
[C] The throws clause of the remote business interface method must throw java.rmi.RemoteException [D] It is not mandatory to define whether the business interface is a Remote or Local interface
The correct answers are A and D.
It is correct, but why answer [C] is wrong?
And, the explanation says:
The EJB 3.0 specification mandates that the methods of the business interface must not throw java.rmi.RemoteException.
Is this correct? I don't remember anything like this from the specs.
Remko Strating
Ranch Hand
Joined: Dec 28, 2006
Posts: 893
posted
0
In EJB2 it was true where every method in the endpoint interface must declare the java.rmi.RemoteException in its throws clause. This exception is used for reporting network problems by using the method.
With EJB3 the container will add this exception to the method so the developer doesn't have to do this in the code. This is done for making the development of EJB more easy.
if business interface is like this
@Rmote
public interface CreditCard implements java.rmi.Remote methods of above interface must throws java.rmi.RemoteException
but if businees interface is like
@Rmote
public interface CreditCard
it is not mendatory for developer add throws RemoteException to methods
but since throws RemoteException is needed, so compiler does it for developer.
Treimin Clark
Ranch Hand
Joined: Nov 12, 2008
Posts: 757
posted
0
Thanks Deepika and Remko
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.