• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One more confusing question from SUN

 
Will Hunt
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Eusebio Floriano
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic