cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Unique constraint error randomly

susubhas
Champ in-the-making
Champ in-the-making
Hi,
I am getting below error randomly. Is this a known issue?

EVERE: Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (SDP30D14_4.SYS_C001981724) violated

### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertByteArray-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_)     values (       ?,       1,        ?,        ?,        ?     )
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (SDP30D14_4.SYS_C001981724) violated

                at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
                at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
                at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)
                at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:632)
                at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:459)
                at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:167)
                at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:114)
                at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:69)
                at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
                at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
                at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
                at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
                at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:59)

14 REPLIES 14

trademak
Star Contributor
Star Contributor
No don't think so. Which database are you using? Do you have a lot of process instances being created at once? Can you provide a bit more background about how you are using Activiti?

Best regards,

susubhas
Champ in-the-making
Champ in-the-making
Hi
I am using activiti with oracle database. Basically i am trying to do bulk operations which is sequential so there will be one process instance at any time. If i try to perform a operation 500 times, midway i get the above mentioned exception.

Rgds,
Sujata

trademak
Star Contributor
Star Contributor
Okay. What does the process instance itself do? Do you also set variables there etc?
Which version of Activiti are you using? Did you do customization or additional configuration of any kind?

Best regards,

susubhas
Champ in-the-making
Champ in-the-making
Yes, process instance will set some variables in the execution context. I am using V5.11.
I am using spring way of starting process engine. I havn't done any customizations to the process engine as such.
I am passing the transaction manager which is used by my application the to the activiti engine also.

jbarrez
Star Contributor
Star Contributor
Could you find out on which column the unique constraint violation is happening?

uprooter
Champ in-the-making
Champ in-the-making
I get the same exception and for me its the primary_key which is violated. I am using version 5.13

Sometimes it is also the table ACT_RU_EXECUTION or ACT_HI_ACTINST also with the primary_key being violated.

trademak
Star Contributor
Star Contributor
Do you have a way to reproduce the issue in every case? Or is it a random issue?
Which database are you using?

Best regards,

uprooter
Champ in-the-making
Champ in-the-making
Database is Oracle 11 and it is a random issue.

brunopalaoro
Champ in-the-making
Champ in-the-making
Uprooter did you find what was the problem? I'm having the same situation here, but running activiti 5.12.