[jboss-user] [EJB3] - Re: Unable to catch RuntimeException in client EJB

Bibhu Jena do-not-reply at jboss.com
Sat Dec 15 08:32:13 EST 2012


Bibhu Jena [https://community.jboss.org/people/bibhu] created the discussion

"Re: Unable to catch RuntimeException in client EJB"

To view the discussion, visit: https://community.jboss.org/message/783569#783569

--------------------------------------------------------------
As per your suggestion,I tried catching the EJBTransactionRolledbackException,but no luck.
The exception is thrown out side of the try() block i.e.exception is thrown after the execution of this method.

Below is my understanding on why it is not able to catch .let me know if doesn't make any sense.

I am using EJB with Seam on server side and GWT (dont bother ;just a GUI tehnology like JSF)on client side.
> @Local public interface SaveUserDataService{ 
> public void save(Person person); 
> } 
> 
> //client EJB which expects a SecurityBreakException 
> @Stateful SaveUserDataServiceBean implements SaveUserDataService{ 
> public void save(Person person){ 
> try{ //code to call dao layer to save a person
>  } catch (SecurityBreakException e) { 
> // parse the exception and show a meaningful message to user 
>           }
>       } 
> } 
> 
> 
>  
> 
When user clicks on save button , the request comes to save() method of SaveUserDataServiceBean which  is the boundary ejb .
Transaction begins when the call stack starts and commits when the call stack ends.Call stack is basically the stack of methods consists of all the methods starting from the boundary method (root of the stack ie "save(Person person) ") till the last call to DAO ;basically all nested method calls.

So, container commits/rolls back the transaction when the stack ends i.e. the boundary method completes execution, and DataChangeListener is triggered just before the commit.

Thanks
Bibhu
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/783569#783569]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121215/c4314912/attachment.html 


More information about the jboss-user mailing list