which statement is true about its exception handling?

Given an JMS message-driven bean, which statement is true about its exception handling?

Given an JMS message-driven bean, which statement is true about its exception handling?

A.
Its message listener method must NOT throw any checked exception.

B.
Its message listener method can throw java.rmi.RemoteException.

C.
Its message listener method can throw any checked exception except
java.rmi.RemoteException.

D.
Its message listener method can throw any checked exception that implements
java.io.Serializable.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Natalia

Natalia

I think the proposed answer is incorrect. In my opinion the answer is C.
A message-driven bean’s message listener method must not throw the java.rmi.RemoteException.
A message-driven bean’s message listener method must not have any throws clause so it can only throw runtime exception. A runtime exception can be a system exception or an application exception (if it is annotated with @ApplicationException). If it throws an application exception marked with rollback=true, the transaction (if any) is rolled back, the exception is rethrown to the resource adapter, and the bean is NOT discarded. If it throws a system exception, the exception is logged, the transaction (if any) is rolled back, and the bean is discarded.