Hi
I encountered problems calling ode processes from multiple threads. I'm using
ODE deployed as JBI component to servicemix running within Geronimo.
My sample is a simple BPEL process which calls a remote service, also deployed
as JBI component to Servicemix, and returning a value. I set up a JMeter test
which is sending SOAP requests "to" my process. Running one thread is no
problem. Calling the process from 4 or more threads results in "Internal
Error"s returned from ODE (not every call of course ;-) ).
---- 8< (start) ----
09:39:45,406 FATAL [BpelServerImpl] Internal Error
org.apache.ode.bpel.iapi.BpelEngineException:
org.apache.ode.bpel.iapi.BpelEngineException: MUST RUN IN TRANSACTION!
at
org.apache.ode.bpel.engine.BpelProcess.doInstanceWork(BpelProcess.java:423)
at
org.apache.ode.bpel.engine.BpelProcess.invokeProcess(BpelProcess.java:259)
at
org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl.doInvoke(MyRoleMessageExchangeImpl.java:132)
at
org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl$1.call(UnreliableMyRoleMessageExchangeImpl.java:48
at
org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl$1.call(UnreliableMyRoleMessageExchangeImpl.java:47
at
org.apache.ode.bpel.engine.BpelProcess$ProcessCallable.call(BpelProcess.java:1122)
at
org.apache.ode.bpel.engine.Contexts.execTransaction(Contexts.java:118)
at
org.apache.ode.bpel.engine.BpelServerImpl$TransactedCallable.call(BpelServerImpl.java:833)
at
org.apache.ode.bpel.engine.BpelServerImpl$ServerCallable.call(BpelServerImpl.java:811)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.ode.bpel.iapi.BpelEngineException: MUST RUN IN
TRANSACTION!
at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:758)
at
org.apache.ode.bpel.engine.BpelProcess.executeCreateInstance(BpelProcess.java:314)
at org.apache.ode.bpel.engine.BpelProcess$2.call(BpelProcess.java:261)
at org.apache.ode.bpel.engine.BpelProcess$2.call(BpelProcess.java:260)
at
org.apache.ode.bpel.engine.BpelProcess$ProcessCallable.call(BpelProcess.java:1122)
at
org.apache.ode.bpel.engine.BpelInstanceWorker.doInstanceWork(BpelInstanceWorker.java:174)
at
org.apache.ode.bpel.engine.BpelInstanceWorker.execInCurrentThread(BpelInstanceWorker.java:108)
at
org.apache.ode.bpel.engine.BpelProcess.doInstanceWork(BpelProcess.java:420)
... 13 more
---- 8< (stop) ----
One thing i tried was to mark the
'org.apache.ode.bpel.engine.Contexts#execTransaction' method with the
synchronized keyword.
This worked fine but was a bit slow ;-)
--- 8< (start) ---
public synchronized <T> T execTransaction(Callable<T> transaction) throws
Exception
--- 8< (stop) ---
I debugged a bit more and I it seems to me that the calling thread "looses" the
transaction after the org.apache.ode.dao.jpa.ProcessDAOImpl#createInstance
call.
--- 8< (start) ---
org.apache.ode.dao.jpa.ProcessDAOImpl.createInstance(CorrelatorDAO)
org.apache.ode.bpel.engine.PartnerLinkMyRoleImpl.invokeMyRoleCreateInstance(MessageExchangeDAO,
Operation, String, CorrelatorDAO)
org.apache.ode.bpel.engine.PartnerLinkMyRoleImpl.invokeMyRole(MessageExchangeDAO)
org.apache.ode.bpel.engine.BpelProcess.invokeProcess(MessageExchangeDAO)
org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl.doInvoke()
org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl.invokeAsync().new
Callable<Void>() {...}.call()
--- 8< (stop) ---
I'm working on Windows XP, Java JDK 1.5.0_12 (Sun).
Is there any know solution to the problem? ;-)
Any help is welcome...
Kristian
---
http://gaswerk.sourceforge.net