• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Application exceptions and BMT  RSS feed

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen in a stateless or MDB with BMT demarcation if we throw an Application Exception after the transaction has been started but not commited ?
According to specs, the app-exception will be re-thrown.
But, according to specs too, these ejbs need to commit or rollback the transaction before the method ends.

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pedro,

I did a little test with my JBoss:



And the result is:

javax.ejb.EJBException: Application error: BMT stateless bean MySLSFBean should complete transactions before returning (ejb1.1 spec, 11.6.1); nested exception is: bmtappexception.MyAppException
Caused by: bmtappexception.MyAppException
at bmtappexception.MySLSFBean.test(MySLSFBean.java:21)



So, even if you throw an application exception, you need to commit/rollback your transaction (probably in a finally clause).

Hope it helps,

Beno�t
 
Pedro Erencia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Beno�t.

Thinking about it the two statements i've mentioned from the specs are really not contradictory. The exception will be rethrown and the method won't have commited or rollbacked, so a sytem-exception is thrown, the transaction rollbacked and the instance discarded .
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!