aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Qn about exceptions from ejbcertificate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Qn about exceptions from ejbcertificate" Watch "Qn about exceptions from ejbcertificate" New topic
Author

Qn about exceptions from ejbcertificate

nachagoni rishi
Greenhorn

Joined: Oct 14, 2004
Posts: 26
Which one of the following statements regarding the client view of exceptions received from an enterprise bean invocation is correct?



1. The client can safely continue the transaction by retrying the operation if an application exception is received.



2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.



3. The client can safely continue the transaction by retrying the operation if a non-application exception is received.



4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.



5. A remote client cannot continue a transaction if javax.transaction.TransactionRolledbackException is received.


correct answer is 5.

why is option 4 wrong.
Serkan Yazici
Ranch Hand

Joined: Apr 24, 2004
Posts: 33
Originally posted by nachagoni rishi:

4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.

why is option 4 wrong.


Because the correct name of this exception is javax.ejb.TransactionRolledbackLocalException
[ November 19, 2004: Message edited by: Serkan Yazici ]

-- SCJP 1.4 (98%), SCJD (98%), SCWCD (96%), OCA Dev (97% avg.), SCBCD (97%), SCJP 1.5 BETA (90%)<br />-- OCP Dev (maybe), MCDBA (probably) SCEA (eventually)<br />-- Haven't tried Firefox yet? Free, open, secure, fast, tabified, and slick!<br />-- <a href="http://www.mozilla.org/products/firefox/" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/</a>
jyothi ve
Ranch Hand

Joined: Aug 03, 2001
Posts: 51
why not option 1 correct?

According the spec 18.3.1 and from the Table 15

Client View: if Client Received App Exception, can attempt to continue computation in the transaction, and eventually commit the transaction.

From the spec I fee option 1 also correct.


Correct me if I am wrong??


Jyothi<br /> <br />Sun Certified Business Component Developer<br />Sun Certified Web Component Developer<br />Sun Certified Java Programmer<br />Oracle Certified SQL & PL-SQL Programmer
Sandesh Tathare
Ranch Hand

Joined: Jun 22, 2003
Posts: 82
Jyothi,

IMO, option 2 is correct against 1:
2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.


Option 1 says: The client can safely continue the transaction by retrying the operation if an application exception is received. But if EJBContext.setRollbackOnly() has been called before throwing application exception, even if client continues transaction it will not commit. So it's a good idea for a client program to check whether transaction has been marked for rollback and then safely continue.

Note: A lot depends on how one interprets word safely here. If we say safely means without any exception, yes then option 1 also makes sense. But while answering above question I interpreted safely means that it's safe to continue transaction and probability of transaction being rollback is less.

Please correct me if I am wrong.


Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.
Mark Lybarger
Ranch Hand

Joined: Dec 19, 2003
Posts: 72
i'm on board with jyothi on this one. seems like 1 is correct to me.

if a bean throws an application exception the transaction _may_ be doomed, but the client can't tell. the client can either contine processing (even retry the same operation ).
Serkan Yazici
Ranch Hand

Joined: Apr 24, 2004
Posts: 33
Originally posted by Mark Lybarger:
i'm on board with jyothi on this one. seems like 1 is correct to me.

if a bean throws an application exception the transaction _may_ be doomed, but the client can't tell. the client can either contine processing (even retry the same operation ).


If a transaction started by the client, client can check if the transaction was marked for rollback or not the same way as BMT beans (using the UserTransaction.getStatus method). So if safely phrase means knowing that the transaction can definetely be committed, then option (2) would be more correct.

However, IMO this is a very ambigiously worded question and I wouldn't lose too much sleep over it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Qn about exceptions from ejbcertificate