Hello,
we have some trouble with the Jta Transaction manager when throwing up exceptions, when a processinstance has been started. Let me describe:
We have the following simplified process start:
Inside the task we are transforming and saving something in our db via our own registered transaction manager. For that we have registered our JTAConfiguration as follows:
public class JtaConfigurationFactory {
private DataSource dataSource;
private String databaseSchemaUpdate;
private TransactionManager transactionManager;
private boolean transactionsExternallyManaged;
boolean jobExecutorActivate = true;
public JtaProcessEngineConfiguration getConfiguration() {
JtaProcessEngineConfiguration conf = new JtaProcessEngineConfiguration();
conf.setDataSource(dataSource);
conf.setDatabaseSchemaUpdate(databaseSchemaUpdate);
conf.setTransactionManager(transactionManager);
conf.setJobExecutorActivate(jobExecutorActivate);
conf.setTransactionsExternallyManaged(transactionsExternallyManaged);
//register a custom incident handler
conf.setCustomIncidentHandlers(Arrays.asList(new RequestIncidentHandler("failedJob")));
return conf;
}
The bean configuraiton xml file:
<!-- Beans -->
<bean id="configurationFactory"
class="com.my.package.JtaConfigurationFactory">
<property name="dataSource" ref="paxDataSource"/>
<property name="databaseSchemaUpdate" value="true"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionsExternallyManaged" value="true"/>
<property name="jobExecutorActivate" value="true"/>
</bean>
<reference id="paxDataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=jdbc/dbSchemaName)"/>
We want the following behaviour:
If an exception occurs inside the service task the exception should be thrown to the component, which is calling #startProcessInstanceByKey(…). If the job is done successfully all the stuff inside the task has to be committed. For that i have set the property asynchronous after.
What we get:
If we start the process instance n times in a short time, the first processinstance-start is throwing the following exception:
org.camunda.bpm.engine.ProcessEngineException: ENGINE-11001 RollbackException while registering synchronization\r\n\tat org.camunda.bpm.engine.impl.cfg.TransactionLogger.exceptionWhileInteractingWithTransaction(TransactionLogger.java:25)\r\n\tat org.camunda.bpm.engine.impl.cfg.jta.JtaTransactionContext.addTransactionListener(JtaTransactionContext.java:77)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.JobManager.hintJobExecutor(JobManager.java:136)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.JobManager.send(JobManager.java:93)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.scheduleAtomicOperationAsync(ExecutionEntity.java:639)\r\n\tat org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:84)\r\n\tat org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)\r\n\tat org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:174)\r\n\tat org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:565)\r\n\tat org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.start(PvmExecutionImpl.java:230)\r\n\tat org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.start(ExecutionEntity.java:427)\r\n\tat org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:50)\r\n\tat org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:29)\r\n\tat org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)\r\n\tat org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)\r\n\tat org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:58)\r\n\tat org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)\r\n\tat org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)\r\n\tat org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:145)\r\n\tat org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:117)\r\n\tat org.camunda.bpm.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:85)\r\n\tat com.somePackage.core.process.service.ProcessService.startProcessInstance(ProcessService.java:231)\r\n\tat Proxyd9c2b986_e702_4499_89ab_32dfe09fdb1f.startProcessInstance(Unknown Source)\r\n\tat Proxyf477e831_a5b2_4f22_aae0_9e4f2597a376.startProcessInstance(Unknown Source)\r\n\tat com.somePackage.inbound.etsi.service.WorkflowTriggerService.triggerNewProcessInstance(WorkflowTriggerService.java:52)\r\n\tat com.somePackage.inbound.etsi.service.EtsiInboundCreator.createInbound(EtsiInboundCreator.java:42)\r\n\tat com.somePackage.inbound.etsi.service.EtsiInboundCreator.createInbound(EtsiInboundCreator.java:14)\r\n\tat Proxya30e9151_8041_48f8_85c5_4bbd61fed117.createInbound(Unknown Source)\r\n\tat com.somePackage.core.rest.InboundResource.createInbound(InboundResource.java:106)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)\r\n\tat org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)\r\n\tat org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)\r\n\tat org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)\r\n\tat org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)\r\n\tat org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)\r\n\tat org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)\r\n\tat org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)\r\n\tat org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:262)\r\n\tat org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)\r\n\tat org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)\r\n\tat org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)\r\n\tat org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)\r\n\tat org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299)\r\n\tat org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:235)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:710)\r\n\tat org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)\r\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\r\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:499)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: javax.transaction.RollbackException: Transaction is marked for rollback\r\n\tat org.apache.geronimo.transaction.manager.TransactionImpl.registerSynchronization(TransactionImpl.java:154)\r\n\tat org.camunda.bpm.engine.impl.cfg.jta.JtaTransactionContext.addTransactionListener(JtaTransactionContext.java:74)\r\n\t… 71 more\r\n"}
Every following start of the processinstance is working fine, but (sometimes also the same issue). So this problem does randomly occur. The interesting thing is, that if i set the “asynchronous Before flag”, this exception does not occur anymore. Also not as a failed job. Everything works fine then and the commit is done.
So this exception is thrown by the camunda engine itself.
- When is camunda throwing this kind of exception with error code ENGINE-11001?
- Any ideas whats wrong or how to bring this to work? It is important, that the class, which is calling #startProcessInstanceByKey is informed about that error. We must not register it as a failed job
I would be very grateful for your help.
Best regards,
Andy