• 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

BeanNotReentrantException

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am quite sure there are no reentrancy issues involved.
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic