a) Head First EJB, Page 546:
If the bean throws a system exception:
- throw a RemoteException if the client is remote
- throw an EJBException if the client is local
This means, that the bean can throw several system exceptions, but the client will get ONLY TWO system exceptions: RemoteException or EJBException.
Is my assumption correct?
b) Head First EJB, Page 558:
Client calls a method on a Remote CMT bean, and the method is marked Mandatory. The caller does not have a transaction context in place when the call comes in. The client gets a TransactionRequiredException.
I think, this is not correct, because TransactionRequiredException is a system exception. The bean will throw TransactionRequiredException, but the client will get a RuntimeException, and this RuntimeException wraps a TransactionRequiredException.
c) Head First EJB, Page 559:
Client calls remove() on a bean that's already been removed. Remote clients get RemoteException, and local clients get EJBException.
That's OK, but it's a little bit misleading, because the bean throws a NoSuchObjectException, the container wraps it in a RemoteException and throw this RemoteException to the client.
Remote clients get RemoteException (wrapping a NoSuchObjectException) and local clients get EJBException (wrapping a NoSuchObjectLocalException).
Is this supplement correct?
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Originally posted by Oliver Roell:
Page 379, section 18.3.5 in the spec says: If a client makes a call to a session object that has been removed, the Container should throw the NoSuchObjectException to a remote client, or the NoSuchObjectLocalException to a local client.
Originally posted by Oliver Roell:
But Head First EJB wrotes on page 559:
Client calls remove() on a bean that's already been removed. Remote clients get RemoteException, and local clients get EJBException.
This is a contradiction between spec and HF EJB, isn't it?
Originally posted by Sven Thor:
If you scroll down six posts in the topic list you will see that I posted the exact same question earlier today about the scenario "Client calls remove() on a bean that's already been removed" on p. 559 i HF EJB. I also don't understand it.
Why don't the client receive a NoSuchObjectException? From the replies I have read I still can't figure this out.
On the EJB object, or more precisely its stub, you can call remove(). I would assume this call to remove() to be treated as any other business method call. The way I understand "a bean that has already been removed" is that both the bean object and the ejb object are gone. So assuming the call from the stub reaches the container, the container will not find any ejb object to handle the remove() call. I would then think it should throw an NoSuchObjectException back to the client.
BTW, looking at the stack trace it seems like a NoSuchObjectException is thrown first and then wrapped in a RemoteException.
Br,
Sven T.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Originally posted by Roger Chung-Wee:
NoSuchObjectException IS-A RemoteException, so there is no conflict.
Consider Paul's rocket mass heater. |