This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 1629
    
  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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: query on enthuware mock exam question related to exception handling in MDB?
 
Similar Threads
Enthuware Mock Exam Question
doHead() method calls??
MessageListenerInterface (Enthuware)
Final mock exam quesion on Head First EJB
just to share