About question enthuware.oce-jpad.v6.2.403

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
jayrmotta
Posts: 3
Joined: Tue Jul 19, 2011 11:32 am
Contact:

About question enthuware.oce-jpad.v6.2.403

Post by jayrmotta »

The question says: "A client of a session bean with container managed transaction demarcation gets a javax.ejb.EJBTransactionRolledbackException."

The answer "The client must have called the method through the bean's local interface." is incorrect according to the exam.

But the explanation says: "However, if the business interface is a remote business interface that extends java.rmi.Remote, the javax.transaction.TransactionrolledbackException is thrown to the clients." that somehow makes the following answer wrong:

"The client may have called the method through the bean's remote or local interface."

Am I right?

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by admin »

No, in EJB 3.1, the remote business interface is not required or expected to be a java.rmi.Remote interface. So even if the client has called the bean through its remote interface, it is possible for the client to get EJBTransactionRolledbackException.

Therefore, "The client must have called the method through the bean's local interface" should be wrong.

HTH,
Paul.

cosminvacaroiu

Re: About question enthuware.oce-jpad.v6.2.403

Post by cosminvacaroiu »

I don't understand why in the Javadoc of JEE6 it says:

EJBTransactionRolledbackException - is for remote clients
EJBTransactionRolledbackLocalException - is for local clients

bluster
Posts: 60
Joined: Wed Apr 23, 2014 6:38 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by bluster »

To clarify, when the answer goes with

Code: Select all

However, if the business interface is a remote business interface that extends java.rmi.Remote, javax.transaction.TransactionRolledbackException is thrown to the clients
a more explicit version would be
However, if the business interface is a 2.1 remote business interface that extends java.rmi.Remote, javax.transaction.TransactionRolledbackException is thrown to the clients

Please confirm if possible if javax.transaction.TransactionRolledbackException is thrown only to 2.1 clients in this scenario, and javax.ejb.EJBTransactionRolledbackException will be thrown to all 3.0 clients. Thanks.

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by admin »

No, I don't think so. In many places, the specification says that TransactionRolledbackException is thrown if the business interface is a remote business interface that extends java.rmi.Remote. For example, in section 14.3.2, table 17, and Section 14.3.7 (last paragraph) refers to Note 79, which says, "If the business interface is a remote business interface that extends java.rmi.Remote, the javax.transaction.TransactionRolledbackException is thrown to the client instead."

So I don't think it is meant for 2.1 only.
-Paul.

bluster
Posts: 60
Joined: Wed Apr 23, 2014 6:38 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by bluster »

Thanks!

swiss-chris
Posts: 11
Joined: Fri Jan 23, 2015 5:05 am
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by swiss-chris »

If an application exception can also mark a transaction for Rollback via @ApplicationException(rollback=true|false), how can we know if the Exception was an application exception or a system exception? I.e. how can I be sure that it was a system exception, as your exam question evaluation suggests?

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by admin »

Marking an application exception with rollback=true doesn't make it a system exception. It will still remain an application exception.

swiss-chris
Posts: 11
Joined: Fri Jan 23, 2015 5:05 am
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by swiss-chris »

admin wrote:Marking an application exception with rollback=true doesn't make it a system exception. It will still remain an application exception.
Of course.

Let me rephrase my question to explain what I'm asking:

In the exam question, you ask
A client of a session bean with container managed transaction demarcation gets a javax.ejb.EJBTransactionRolledbackException. Assuming that the session bean executes within the client's transaction context, and that the transaction was not already rolled back before calling the bean method, which of the following statements are correct?
Two of the options you propose as answers are
  • The bean method encountered a system exception.
  • The bean method encountered an application exception.
As I understand from your explanations, there are two kinds of exceptions that can result in the client getting a javax.ejb.EJBTransactionRolledbackException:
  • - system exception
  • - application exception with @ApplicationException(rollback=true)
Therefore it is impossible to know from the information you provide in the exam question if "The bean method encountered a system exception" or if "The bean method encountered an application exception".

Neither answer should be marked as correct then.

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question enthuware.oce-jpad.v6.2.403

Post by admin »

OK, I see what you mean. The options show a possibility. It could be either a system exception or an application exception with rollback=true. You are right, they may be misinterpreted. Fixed.
thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests