• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which exception is thrown in this case.

 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If an enterprise bean with bean-managed transaction demarcation calls getRollbackOnly() and setRollbackOnly() methods of the EJBContext interface Which exception is thrown.

Suddenly I came up with this question and do not have book to refer to.
If someone can answer that will be great!

Thanks,
Gemini
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.lang.IllegalStateException

Amol.
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amol.

I just found the answer in http://java.boot.by/bcd-guide/ch11s04.html
and came here to post reponse to myself :-)

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same is true otherway as well..

If an instance of an enterprise bean with container-managed transaction demarcation attempts to invoke the getUserTransaction() method of the EJBContext interface, the Container must throw (and log - MDB ONLY) the java.lang.IllegalStateException.
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats great!!!
Amol.
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Gemini,
Just had an off the corner thought,
Do you mean that Entity and Session beans wont log if IllegalStateException is thrown???
PS: Refer your last post only.
Amol.
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amol,

No. that menas in case of session and entity beans log, and then throw.

Whereas in case of MDB only log. It does not throw exception, since there is no client..

makes sence?

Gemini

Also, In case of stateless sesision bean and MDB there is one more step,
remove the instance that is throwing this exception.
[ March 16, 2005: Message edited by: Gemini Moses ]
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Here is what I went through,

Since java.lang.IllegalStateException is the System exception, container will take following steps once it occurs.
1) Roll back Tx ( CMT only )
2) Discard Instance
3) Log an error

So as for last posting, Entity and Session beans too log the stuff if IllegalStateException is thrown if EntityContext.getUserTransaction is called by a CMT bean.

And heance that....(log - mdb only) ....made my eyebrows go up (he he).
sure mdb doesnt throw any exception to client(there is not one)....container throws that to the bean.
Amol.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic