Page 1 of 1

About question enthuware.oce-jpad.v6.2.403

Posted: Wed Jan 18, 2012 7:27 pm
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?

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

Posted: Wed Jan 18, 2012 9:08 pm
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.

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

Posted: Thu May 31, 2012 4:46 am
by cosminvacaroiu
I don't understand why in the Javadoc of JEE6 it says:

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

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

Posted: Wed Dec 31, 2014 1:29 pm
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.

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

Posted: Wed Dec 31, 2014 9:08 pm
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.

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

Posted: Sun Jan 04, 2015 1:11 pm
by bluster
Thanks!

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

Posted: Sun Feb 08, 2015 4:13 am
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?

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

Posted: Sun Feb 08, 2015 9:42 am
by admin
Marking an application exception with rollback=true doesn't make it a system exception. It will still remain an application exception.

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

Posted: Mon Feb 09, 2015 4:54 am
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.

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

Posted: Mon Feb 09, 2015 5:30 am
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.