• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BeanNotReentrantException

 
Karthik Jayaprakasham
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am quite sure there are no reentrancy issues involved.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Karthik Jayaprakasham
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,
we are also getting the same Exception can anybody can give the solution and
how did u overcome the problem Mr.Karthick
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic