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 MessageListenerInterface (Enthuware) 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 "MessageListenerInterface (Enthuware)" Watch "MessageListenerInterface (Enthuware)" New topic
Author

MessageListenerInterface (Enthuware)

Jarrod Felino
Greenhorn

Joined: Nov 15, 2008
Posts: 26
In Enthuware Test 3 Question 19:

The answers state this about onMessage() of a Message Driven Bean:

It can throw application exception. However, EJB 3.0 spec also adds that Message-driven beans should not, in general, throw RuntimeExceptions.



However how is it possible to throw an application exception when the MessageListener does not declare any checked exceptions??? Is the only possible way to throw a subclass of Runtime and annotate with @ApplicationException??
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Is the only possible way to throw a subclass of Runtime and annotate with @ApplicationException??

Yes.


[My Blog]
All roads lead to JavaRanch
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
A remark concering @ApplicationException: You can also use the deployment descriptor to declare an exception as an application exception: I see no other way to use an already defined, unchecked exception (here java.lang.ArithmeticException) directly as an application
exception.


SCJP 5 (98%) - SCBCD 5 (98%)
 
Don't get me started about those stupid light bulbs.
 
subject: MessageListenerInterface (Enthuware)
 
Similar Threads
Application Exception and MDB Java Beat Questin
Confused by Ets's 2 questions
Query about MDB throwing application exception
Enthuware Explanation Doubt-23
Need help in MDB