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)
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.
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.