cancel
Showing results for 
Search instead for 
Did you mean: 

runtimeService.signal(executionId, variables) throws excetionduplicate key value violates unique constraint

mljolje
Champ in-the-making
Champ in-the-making
Activiti version: 5.19.0.1

When signaling finish of service task by:
runtimeService.signal(executionId, variables);


we are getting something this exception:


org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_act_hi_actinst"
  Detail: Key (id_)=(20203) already exists.
### The error may involve org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_HI_ACTINST (         ID_,         PROC_DEF_ID_,         PROC_INST_ID_,         EXECUTION_ID_,         ACT_ID_,         TASK_ID_,         CALL_PROC_INST_ID_,         ACT_NAME_,         ACT_TYPE_,         ASSIGNEE_,         START_TIME_,         END_TIME_,         DURATION_,         TENANT_ID_       ) values                    (?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?)        ,           (?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?)        ,           (?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?,           ?)
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_act_hi_actinst"
  Detail: Key (id_)=(20203) already exists.
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)
        at org.activiti.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:844)
        at org.activiti.engine.impl.db.DbSqlSession.flushPersistentObjects(DbSqlSession.java:813)
        at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:791)
        at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:612)
        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)
        at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
        at org.activiti.engine.impl.RuntimeServiceImpl.signal(RuntimeServiceImpl.java:231)
        at com.ericsson.ramt.engineer.activiti.AbstractServiceTask.signalExecution(AbstractServiceTask.java:81)
        at com.ericsson.ramt.engineer.activiti.AbstractServiceTask$1.run(AbstractServiceTask.java:69)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_act_hi_actinst"
  Detail: Key (id_)=(20203) already exists.
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413)
        at com.zaxxer.hikari.proxy.PreparedStatementProxy.execute(PreparedStatementProxy.java:44)
        at com.zaxxer.hikari.proxy.PreparedStatementJavassistProxy.execute(PreparedStatementJavassistProxy.java)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
        … 18 more




Any help?
Thanks,
BR
M.
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Already answered.