Forums Register Login

One more confusing question from SUN

+Pie Number of slices to send: Send
Which is true when a remote client receives an exception from an EJB invocation?


A The exception cannot be from the java.rmi package.
B The client might be able to re-invoke the method successfully.
C The exception cannot be a system exception.
D If the client is associated with a transaction, the transaction will have been rolled back.

What exception is he talking about any idea ?
+Pie Number of slices to send: Send
 

Originally posted by Will Hunt:
Which is true when a remote client receives an exception from an EJB invocation?



I think it is not about one specific exception.

Originally posted by Will Hunt:
A The exception cannot be from the java.rmi package.



False. It CAN be. Every method in home and remote interfaces that a remote client can call MUST declare java.rmi.RemoteException.

Originally posted by Will Hunt:
B The client might be able to re-invoke the method successfully.



True. Let�s suppose that the client called the remove on a stateful session bean that is on a transaction context. The client will receve a big fat RemoveException. But if he called the same method after the transaction ends, the container can remove the bean.


Originally posted by Will Hunt:
C The exception cannot be a system exception.



False. It can be. Despite of the RemoteException be a checked exception( extends Exception but does not extend RunTimeException), it IS considered a System exception. Think of a system exception as a exception that the client cant recover. ie: If a client recece a RemoteException, he can�t know if it was cause by a NullPointerException, ArrayOutOfBoundsException and others RunTimeExceptions.

Originally posted by Will Hunt:
D If the client is associated with a transaction, the transaction will have been rolled back.



FALSE. If the exception throwed was a checked excepting, it will NOT rollback, only with system exceptions. Why ?
Because if it�s checked exception, it�s the bean provider�s resposability to
catch this exception and calls rollback adn than throw it again if necessarity. With RunTimeException, the bean provider can�t treat it so the container will rollback it

I hope it can help ya.

Regards,
[ August 02, 2004: Message edited by: Vinicius Boson ]
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 567 times.
Similar Threads
ApplicationException and rollback
client view of exceptions
TrasactionRolledbackException
a mock question about transcation
Qn about exceptions from ejbcertificate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:33:16.