About Question enthuware.oce-ejbd.v6.2.543 :

Moderator: admin

Post Reply
ETS User

About Question enthuware.oce-ejbd.v6.2.543 :

Post by ETS User »

Hi,

I think that in the explanation something is missing regarding this:

"If a message-driven bean instance starts a transaction in a message listener method or interceptor method, it must commit the transaction before the message listener method (or all its interceptor methods) returns." - From spec

Since this is the problem right?

Another thing, when I was studying I saw that MDB can have system exceptions and throw EJBExceptions, so I'm a bit confused with this.

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

Re: About Question enthuware.oce-ejbd.v6.2.543 :

Post by admin »

Yes, that is the problem. In the given code, the bean's onMessage leaves the transaction unfinished i.e. it doesn't commit or rollback the transaction.
As the explanation says, in this situation the container simply rolls back the transaction and discards the bean instance.

It is true that an MDB can throw system exceptions but that is irrelevant to this question. Because this bean doesn't throw any exception.

HTH,
Paul.

ETS User

Re: About Question enthuware.oce-ejbd.v6.2.543 :

Post by ETS User »

oh ok, I read the spec again and it says: "Log this as an application error to alert the System Administrator". I had the idea that an exception was thrown in this case. But I understood now.

Thanks Paul =)

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests