AnsweredAssumed Answered

Getting SQLIntegrityConstraintViolationException sometimes when creating a new process instance

Question asked by arjunbhattacherjee on Jun 17, 2014
Latest reply on Jun 19, 2014 by trademak
Hi,

I am using Activiti 5.14 with an oracle 11g database and using it within a standalone multithreaded Spring application. When creating a new process instance we sometimes get this UniqueConstraintViolation exception and the column in question seems to be the ID_. Is this a multithreading issue ?

We are using the API call RuntimeService.startProcessInstanceByMessage to start a new process instance.

The error is as below


### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.insertExecution-Inline
### The error occurred while setting parameters
### SQL: insert into STP_OWN.ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_)     values (       ?,       1,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?     )
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (STP_OWN.SYS_C003247279) violated

   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[xcheck-main-1.0.0.jar:na]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150) ~[xcheck-main-1.0.0.jar:na]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137) ~[xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:540) ~[xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:443) ~[xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:170) ~[xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:117) ~[xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66) [xcheck-main-1.0.0.jar:na]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) [xcheck-main-1.0.0.jar:na]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) [xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) [xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) [xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) [xcheck-main-1.0.0.jar:na]
   at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByMessage(RuntimeServiceImpl.java:236) [xcheck-main-1.0.0.jar:na]
   at com.pimco.xcheck.workflow.impl.WorkflowEngineImpl.startProcess(WorkflowEngineImpl.java:139) [xcheck-main-1.0.0.jar:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_13]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_13]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_13]
   at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_13]
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [xcheck-main-1.0.0.jar:na]
   at sun.proxy.$Proxy51.startProcess(Unknown Source) [na:na]
   at com.pimco.xcheck.facade.CrosscheckServiceImpl.createTransfer(CrosscheckServiceImpl.java:244) [xcheck-main-1.0.0.jar:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_13]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_13]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_13]
   at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_13]
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [xcheck-main-1.0.0.jar:na]
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [xcheck-main-1.0.0.jar:na]
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [xcheck-main-1.0.0.jar:na]
   at sun.proxy.$Proxy52.createTransfer(Unknown Source) [na:na]
   at com.pimco.xcheck.facade.avro.CrosscheckServiceFacade.createTransfer(CrosscheckServiceFacade.java:128) [xcheck-main-1.0.0.jar:na]
   at com.pimco.xcheck.facade.avro.CrosscheckMessageResponder.respond(CrosscheckMessageResponder.java:48) [xcheck-main-1.0.0.jar:na]
   at com.pimco.xcheck.facade.avro.CrosscheckMessageResponder.respond(CrosscheckMessageResponder.java:15) [xcheck-main-1.0.0.jar:na]
   at com.pimco.common.avro.ipc.jms.AvroJmsServer.onMessage(AvroJmsServer.java:46) [xcheck-main-1.0.0.jar:na]
   at com.pimco.common.messaging.jms.JmsSubscriber.onMessage(JmsSubscriber.java:195) [xcheck-main-1.0.0.jar:na]
   at com.ibm.mq.jms.MQMessageConsumer$FacadeMessageListener.onMessage(MQMessageConsumer.java:399) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl$JmsProviderMessageListener.onMessage(JmsMessageConsumerImpl.java:922) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.honourNoLocal(WMQAsyncConsumerShadow.java:565) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.consumer(WMQAsyncConsumerShadow.java:399) [xcheck-main-1.0.0.jar:na]
   at com.ibm.mq.jmqi.remote.internal.RemoteAsyncConsume.driveConsumer(RemoteAsyncConsume.java:1526) [xcheck-main-1.0.0.jar:na]
   at com.ibm.mq.jmqi.remote.internal.RemoteDispatchThread.run(RemoteDispatchThread.java:395) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.runTask(WorkQueueItem.java:209) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.commonservices.workqueue.SimpleWorkQueueItem.runItem(SimpleWorkQueueItem.java:100) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.commonservices.workqueue.WorkQueueItem.run(WorkQueueItem.java:224) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.runWorkQueueItem(WorkQueueManager.java:298) [xcheck-main-1.0.0.jar:na]
   at com.ibm.msg.client.commonservices.j2se.workqueue.WorkQueueManagerImplementation$ThreadPoolWorker.run(WorkQueueManagerImplementation.java:1220) [xcheck-main-1.0.0.jar:na]
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (STP_OWN.SYS_C003247279) violated

Outcomes