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

Moderator: admin

Post Reply
admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Hi,
Table 15 of EJB 3.1 specification clearly says that in case of any system exception, the container must throw EJBException to client. So I think the implementation is not compliant. It does show root cause (i.e. the cause by section) as EJBTransactionRequiredException, as I suspected.

May be since EJBTransactionRequiredException extends EJBException, it can be argued that it is complaint. But the wordings of the specification are very clear. It says, "Throw EJBException".

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

sanju.ait@gmail.com
Posts: 38
Joined: Fri Aug 16, 2013 11:37 pm
Contact:

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

Post by sanju.ait@gmail.com »

If client of Bean A would also have been a statless session bean, its instance would also have been discarded?

sanju.ait@gmail.com
Posts: 38
Joined: Fri Aug 16, 2013 11:37 pm
Contact:

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

Post by sanju.ait@gmail.com »

Bean instance is discarded when system exception is thrown from bean.

Here bean A could have caught system exception from bean B and handled properly, I agree if bean A would have thrown system exception from bean B as it is to the container, than bean A instance will also get discarded, but it is no where mentioned that bean A didn't handle any system exception it got from bean B. So how bean A instance got discarded?

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

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

Post by admin »

You are right, it doesn't say whether A handles the exception or not. That is why "Bean A will be discarded is not in the options" either. The explanation is just talking about a hypothetical situation where the exception is not caught because normally such system exception are not meant to be caught.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

sanju.ait@gmail.com
Posts: 38
Joined: Fri Aug 16, 2013 11:37 pm
Contact:

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

Post by sanju.ait@gmail.com »

Thanks Paul, if catching system exception would also have discarded instance, I would have been in big trouble, thanks.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

A system exception in a bean's method translates to an EJBException.
Does this translation happen in Bean A's method? Bean A's method receives javax.ejb.EJBTransactionRolledbackException, wraps it to EJBException and throws it further down to the call chain?

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

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

Post by admin »

No, the translation is done by the container. Bean A's method will simply propagate whatever exception it receives up to the container (if it is not caught by the bean A's method). The container will then decide what exception should actually be thrown to the client.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

I see, thank you very much for all your explanations. Passed today with 91%.

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

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

Post by admin »

Congratulations!! Good score!
What did you miss?
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests