Dear HVA,
Check the
EJB 2.1 Specs, Section 18.2.2 (System Exceptions), Page 397. It says:
An enterprise bean business method, message listener method, or container callback method may encounter various exceptions or errors that prevent the method from successfully completing. Typically, this happens because the exception or error is unexpected, or the exception is expected but the EJB Provider does not know how to recover from it. Examples of such exceptions and errors are: failure to obtain a database connection, JNDI exceptions, unexpected RemoteException from invocation of other enterprise beans, unexpected RuntimeException, JVM errors, and so on.
If the enterprise bean method encounters a system-level exception or error that does not allow the method to successfully complete, the method should throw a suitable non-application exception that is compatible with the method�s throws clause. While the EJB specification does not prescribe the exact usage of the exception, it encourages the Bean Provider to follow these guidelines:
If the bean method encounters a RuntimeException or error, it should simply propagate the error from the bean method to the container (i.e., the bean method does not have to catch the exception).If the bean method performs an operation that results in a checked exception that the bean method cannot recover, the bean method should throw the javax.ejb.EJBException that wraps the original exception.Any other unexpected error conditions should be reported using the javax.ejb.EJBException.
And Section 17.6.3.2 (Required), Page 387:
A transaction must be started before the dequeuing of the JMS message and, hence, before the invocation of the message-driven bean�s onMessagemethod. The resource manager associated with the arriving message is enlisted with the transaction as well as all the resource managers accessed by the onMessagemethod within the transaction. If the onMessagemethod invokes other enterprise beans, the container passes the transaction context with the invocation. The transaction is committed when the onMessage method has completed. If the onMessagemethod does not successfully complete or the transaction is rolled back, message redelivery semantics apply.
Share Knowledge to gain it.<br /> <br />SCJP 1.2, SCDJWS 1.4, SCWCD 1.4, SCBCD 1.3, ICAD