File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes query on enthuware mock exam  question related to exception handling in MDB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "query on enthuware mock exam  question related to exception handling in MDB?" Watch "query on enthuware mock exam  question related to exception handling in MDB?" New topic
Author

query on enthuware mock exam question related to exception handling in MDB?

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

a question from enthuware mock kit has an option that goes like this. We have to choose correct.

OPTION A - onMessage() of a Message Driven Bean is not allowed to throw application exceptions.

EXPLANATION : It can throw application exceptions. However, since onMessage() cannot throw checked exceptions, the only way to throw an application is to throw a subclass of RuntimeExcecption and annotate with @ApplicationException.


can we apply the same explanation for lifecycle callback interceptor methods ? why ?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1638
    
  23

can we apply the same explanation for lifecycle callback interceptor methods ?

A MDB is not allowed to throw an Application Exception from a lifecycle callback interceptor method.

14.3.5 Exceptions from PostConstruct and PreDestroy Methods of a Message-Driven Bean
Bean method condition | Bean method exception | Container action
Bean is message-driven bean | System exceptions | Log the exception or error. Discard instance.


In fact all lifecycle callback methods (not only for MDB's) are not allowed to throw an application exception. (check the table ch. 6.4 Handling of exceptions in my notes)

Regards,
Frits
 
wood burning stoves
 
subject: query on enthuware mock exam question related to exception handling in MDB?
 
Similar Threads
doHead() method calls??
Enthuware Mock Exam Question
MessageListenerInterface (Enthuware)
Final mock exam quesion on Head First EJB
just to share