• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

should the container discards the ejb instance when an application exception thrown?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I need your help to clear my doubt - should the container discard the instance of EJB if a business method of that EJB throws an application exception?

It seems that I found two different answers/explanations from two different study resource:

1. From the Whizlab free mock exam question #10:

Which of the following statement is incorrect about the how the exceptions are handled in EJBs?

A. When a business method of an enterprise bean throws an application exception, the container discards that instance of the bean.

B. Message driven beans are not allowed to throw application exceptions to the client.

C. When a business method of an enterprise bean throws an application exception, the container always automatically rolls back the transaction.

D. The class of the exception received by the client is the same the class of the exception when the bean throws an application exception.


Answer: C is the correct answer.



2. From MZ's study notes: (Chapter 12):

it writes only the system exception will cause the container DISCARD the instance.


Can someone clear the cloud for me?

thanks

Helen

SCJP
SCWCD
SCDJWS
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Helen,

I think in answer A) a systems exeception is meant.

Michael
 
Helen Ge
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael, thanks for your reply. I think it's a mistake on the Whizlab's mock exam. When I prepared my SCDJWS, I found some errors in the Whizlab mock exam too. I need to contact them for the correction.

Helen Ge

SCJP
SCWCD
SCDJWS
 
You showed up just in time for the waffles! And 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