This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MessageListenerInterface (Enthuware)

 
Jarrod Felino
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the only possible way to throw a subclass of Runtime and annotate with @ApplicationException??

Yes.
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic