Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Enthuware error test 1 Q23

 
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A MDB can not throw a checked exception right? IOException is checked so can it be thrown by MDB?
 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. EJB spec does not allow I/O operation, so IOException is out of question.
2. If a X(system/ checked)X exception is thrown, container destroy the MDB bean instance, assuming (MDB) bean instance is not consistent.

- X(system/ checked)X : I am not able to recollect completely at the moment, please check the document/book.
 
Yucca Nel
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right that it does not allow IO operation(the spec) but that does not mean you can not throw your own IOException. The IOException is in fact allowed in netbeans and no compile error is shown. However the rules of overriding interfaces are applied so if one overrides MessgaListener.onMessage() you can not throw IOException.
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic