1

I have a situation where I need to call methodB() of an EJB from methodA() of the same EJB, with a new transaction starting in methodB().

I read on some threads that getting a reference to the EJB through

sessionContext.getBusinessObject(EjbLocalInterface.class);

will work. But it gives me a

java.lang.Exception: com.ibm.ejs.container.UnknownLocalException: nested exception is: java.lang.IllegalStateException: Requested business interface not found.

I am currently working on EJB 2.1

Sahil Dave
  • 353
  • 1
  • 11
  • 25

2 Answers2

3

javax.ejb.SessionContext.getBusinessObject() is an EJB 3.0 method.

I've used javax.ejb.SessionContext.getEJBLocalObject() to do what you're trying to do successfully in the (distant) past. You will need to cast it to your business interface though.

Steve C
  • 18,876
  • 5
  • 34
  • 37
0

You should be able to manually start and close the transactions if you use bean managed transactions:-

Bean Transaction Types

Davos555
  • 1,974
  • 15
  • 23