About Question enthuware.oce-ejbd.v6.2.449 :
Moderator: admin
About Question enthuware.oce-ejbd.v6.2.449 :
You need to specify that A is a Stateless session bean. For Singleton or Stateful session beans, the bean will not be discarded.
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
That was me 

-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
I don't think that is true as per section 14.3.1, which shows that a session bean is discarded upon a system exception.
If you like our products and services, please help us by posting your review here.
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
In 14.3.1 there are the following notes:
and[C] Discard instance means that the container must not invoke any business methods or container callbacks
on the instance. Discarding does not apply if the bean is a Singleton.
[A] Discarding not apply if the bean is a Singleton.
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
Another observation (I am not sure about this one): if I have understood correctly, the container destroys the bean that throws the EJBException (the bean B) and not the one that receives it (bean A). If bean A catches and handles the exception instead of re-throwing it, it will not be destroyed.
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
I created a test project to test this. Indeed, as you say, bean A is destroyed and not bean B. This seems strange to me, isn't the bean that throws the exception discarded?
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
Duh, bean A was discarded because it didn't handle the exception, and rethrew it. And since it threw an EJBException, it was discarded. Now that I handle it, it is not destroyed any more.
So, the question is, why isn't bean B destroyed, since it throws an EJBException.
So, the question is, why isn't bean B destroyed, since it throws an EJBException.
-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
You are right. The bean that throws a system exception out to the container is the one that is discarded.
In this case, the question should specify that no exception handling is done in Bean A. The explanation should be updated accordingly.
As to why Bean B is not discarded, I think it is because it was never invoked by the container. The container throws javax.ejb.EJBTransactionRequiredException to mA() even before invoking mB().
In this case, the question should specify that no exception handling is done in Bean A. The explanation should be updated accordingly.
As to why Bean B is not discarded, I think it is because it was never invoked by the container. The container throws javax.ejb.EJBTransactionRequiredException to mA() even before invoking mB().
If you like our products and services, please help us by posting your review here.
-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
I think you are misinterpreting these statements. It is saying that the concept of discarding does not apply to singletons. It does not mean that only singleton beans are not discarded. I believe Table 15 given in this section applies to all session beans.deadlock_gr wrote:In 14.3.1 there are the following notes:
and[C] Discard instance means that the container must not invoke any business methods or container callbacks
on the instance. Discarding does not apply if the bean is a Singleton.
[A] Discarding not apply if the bean is a Singleton.
thank you,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 9
- Joined: Mon Oct 08, 2012 10:09 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
Actually, for the explaination "Therefore, when it calls mB(), it will get a javax.ejb.EJBTransactionRequiredException (a remote client would get javax.transaction.TransactionRequiredException)."
A client would get javax.transaction.TransactionRequiredException only if the client EJB invoked using EJB 2.1 remote view or web service view. Not for EJB 3.1 remote client.
A client would get javax.transaction.TransactionRequiredException only if the client EJB invoked using EJB 2.1 remote view or web service view. Not for EJB 3.1 remote client.
-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
Footnote 69 on page 369 of EJB 3.1 specification says, "If the business interface is a remote business interface that extends java.rmi.Remote, the javax.transaction.TransactionRequiredException is thrown to the client instead."Jofen wrote:Actually, for the explaination "Therefore, when it calls mB(), it will get a javax.ejb.EJBTransactionRequiredException (a remote client would get javax.transaction.TransactionRequiredException)."
A client would get javax.transaction.TransactionRequiredException only if the client EJB invoked using EJB 2.1 remote view or web service view. Not for EJB 3.1 remote client.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
The explanation says "a remote client would get javax.transaction.TransactionRequiredException".
I guess it should be :
I guess it should be :
This quote comes from 13.6.2.5 of the spec.If EJB 2.1 client view is used, the container throws the javax.transaction.TransactionRequireException exception if the client is remote client or the javax.ejb.TransactionRequiredLocalException if the client is local client.
-
- Site Admin
- Posts: 9839
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.449 :
The statement in the explanation is correct. Please see my post above. The statement about EJB 2.1 is also correct but not relevant here.
Paul.
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 1 guest