wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes BeanNotReentrantException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "BeanNotReentrantException" Watch "BeanNotReentrantException" New topic
Author

BeanNotReentrantException

Karthik Jayaprakasham
Greenhorn

Joined: Jan 15, 2004
Posts: 21
I have the following scenario
Bean A is a stateful bean and has two methods connect() and disconnect()
Bean B is a stateless bean and has a business method businessMethod()
Now ..
(when I say BeanA i mean the component interface)..
BeanB.businessMethod calls BeanA.connect();
...// Do some processing
BeanB.businessMethod calls BeanA.disconnect();

All's well untill now...Now I want to call remove on BeanA to release resources instead of letting the container having to passivate beans (after the time out persiod).
So I call
BeanB.businessMethod calls BeanA.remove()
which throws
com.ibm.ejs.container.BeanNotReentrantException: TX_METHOD_READY: wrong transaction at BeanB .businessMethod (line:xx).
So here's the whole scenario once again:

The code is running on WebSphere 5.0.
Any ideas why this error occurs or what am I doing wrong...Cos I don't see any reentrancy issues here, as only beanB is calling bean A and not the other way around. Also I am calling the business methods and the callback methods within the same bean instance (from inside the business method)
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
Hi Kathik:
It is diffcult to diagnose the problem you are having with the code snap shot you posted on the screen. However I want to say that reentrant happens when a bean say A calls bean B which attempts a call back to bean A; so if within your BeanA.connect() or BeanA.disconnect() methods, you attempted a call back to BeanB; you sure going to have a reentrance issue as session beans just do not allow reentrance.
Karthik Jayaprakasham
Greenhorn

Joined: Jan 15, 2004
Posts: 21
I am quite sure there are no reentrancy issues involved.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
My guess is that the container has placed an implicit transaction around the initiating method call, and trying to remove B before the transaction has either committed or rolled back is generating the error you are seeing.
Have you any way of disabling transactions fo this sort of call?
I could be wrong of course. This is not my main area of expertise.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Karthik Jayaprakasham
Greenhorn

Joined: Jan 15, 2004
Posts: 21
Nopes, I can't disable the transaction because it is a CMT.
And strangest thing is that this code works on any verion of JBoss
suresh gonuguntla
Greenhorn

Joined: Feb 22, 2006
Posts: 11
HI ,
we are also getting the same Exception can anybody can give the solution and
how did u overcome the problem Mr.Karthick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BeanNotReentrantException