[ 
https://issues.apache.org/jira/browse/SYNCOPE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Chicchiriccò updated SYNCOPE-21:
------------------------------------------

    Description: 
When starting with an empty database, Activiti just creates its own tables and 
everything goes smooth: when, instead, the database is already populated 
(including Activiti tables), an exception is thrown, reported below.

I can guess that this is happening because there is a sort of incremental 
mechanism for generating ids that does not take into account existing rows on 
ACT_HI_ACTINST table.

org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: 
org.apache.openjpa.lib.jdbc.ReportingSQLException: Unique index or primary key 
violation: "PRIMARY_KEY_FB0 ON PUBLIC.ACT_HI_ACTINST(ID_)"; SQL statement:
insert into ACT_HI_ACTINST (
ID_,
PROC_DEF_ID_,
PROC_INST_ID_,
EXECUTION_ID_,
ACT_ID_,
ACT_NAME_,
ACT_TYPE_,
ASSIGNEE_,
START_TIME_,
END_TIME_,
DURATION_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?
) [23505-164] {prepstmnt 2118016446 insert into ACT_HI_ACTINST ( ID_, 
PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, ACT_NAME_, ACT_TYPE_, 
ASSIGNEE_, START_TIME_, END_TIME_, DURATION_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ? ) [params=?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?]} [code=23505, state=23505]
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:247)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:223)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:72)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.execute(LoggingConnectionDecorator.java:1258)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:367)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.execute(JDBCStoreManager.java:1768)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:367)
 ~[openjpa-all-2.2.0.jar:2.2.0]
at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:22)
 ~[mybatis-3.0.6.jar:3.0.6]
at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:51)
 ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:29) 
~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:88) 
~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:43) 
~[mybatis-3.0.6.jar:3.0.6]
at 
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:122)
 ~[mybatis-3.0.6.jar:3.0.6]
... 90 common frames omitted
16:46:49.775 ERROR

  was:
Test case:
1. As soon as the console is started create a new user.

Raised exception is the following.

11:48:28.644 ERROR org.syncope.core.rest.controller.AbstractController - 
Exception thrown by REST methods 
org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: 
org.apache.openjpa.lib.jdbc.ReportingSQLException: Unique index or primary key 
violation: "PRIMARY_KEY_FB0 ON PUBLIC.ACT_HI_ACTINST(ID_)"; SQL statement:
.......
        at 
org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
 ~[activiti-engine-5.8.jar:5.8]
        at 
org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:49)
 ~[activiti-engine-5.8.jar:5.8]
        at 
org.syncope.core.workflow.ActivitiUserWorkflowAdapter.create(ActivitiUserWorkflowAdapter.java:218)
 ~[ActivitiUserWorkflowAdapter.class:na]
        at 
org.syncope.core.workflow.ActivitiUserWorkflowAdapter.create(ActivitiUserWorkflowAdapter.java:202)
 ~[ActivitiUserWorkflowAdapter.class:na]
        at 
org.syncope.core.workflow.AbstractUserWorkflowAdapter.create(AbstractUserWorkflowAdapter.java:48)
 ~[AbstractUserWorkflowAdapter.class:na]
.......

I think that we have to perform two actions in the following order:
1. catch the exception in order to return a friendly message in case of this 
error occurs
2. try with the latest version of activity

In case of the action at the point 2 doesn't resolve the issue we have to 
replicate the failure and try fix the bug asap.




       Assignee:     (was: fabio martelli)
    
> Sometimes user create/update/delete fails
> -----------------------------------------
>
>                 Key: SYNCOPE-21
>                 URL: https://issues.apache.org/jira/browse/SYNCOPE-21
>             Project: Syncope
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.1-incubating
>         Environment: Console in embedded mode.
>            Reporter: fabio martelli
>            Priority: Critical
>              Labels: workflow
>
> When starting with an empty database, Activiti just creates its own tables 
> and everything goes smooth: when, instead, the database is already populated 
> (including Activiti tables), an exception is thrown, reported below.
> I can guess that this is happening because there is a sort of incremental 
> mechanism for generating ids that does not take into account existing rows on 
> ACT_HI_ACTINST table.
> org.apache.ibatis.exceptions.PersistenceException:
> Error updating database. Cause: 
> org.apache.openjpa.lib.jdbc.ReportingSQLException: Unique index or primary 
> key violation: "PRIMARY_KEY_FB0 ON PUBLIC.ACT_HI_ACTINST(ID_)"; SQL statement:
> insert into ACT_HI_ACTINST (
> ID_,
> PROC_DEF_ID_,
> PROC_INST_ID_,
> EXECUTION_ID_,
> ACT_ID_,
> ACT_NAME_,
> ACT_TYPE_,
> ASSIGNEE_,
> START_TIME_,
> END_TIME_,
> DURATION_
> ) values (
> ?,
> ?,
> ?,
> ?,
> ?,
> ?,
> ?,
> ?,
> ?,
> ?,
> ?
> ) [23505-164] {prepstmnt 2118016446 insert into ACT_HI_ACTINST ( ID_, 
> PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, ACT_NAME_, ACT_TYPE_, 
> ASSIGNEE_, START_TIME_, END_TIME_, DURATION_ ) values ( ?, ?, ?, ?, ?, ?, ?, 
> ?, ?, ?, ? ) [params=?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?]} [code=23505, 
> state=23505]
> at 
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:247)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:223)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:72)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.execute(LoggingConnectionDecorator.java:1258)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:367)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.execute(JDBCStoreManager.java:1768)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:367)
>  ~[openjpa-all-2.2.0.jar:2.2.0]
> at 
> org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:22)
>  ~[mybatis-3.0.6.jar:3.0.6]
> at 
> org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:51)
>  ~[mybatis-3.0.6.jar:3.0.6]
> at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:29) 
> ~[mybatis-3.0.6.jar:3.0.6]
> at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:88) 
> ~[mybatis-3.0.6.jar:3.0.6]
> at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:43) 
> ~[mybatis-3.0.6.jar:3.0.6]
> at 
> org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:122)
>  ~[mybatis-3.0.6.jar:3.0.6]
> ... 90 common frames omitted
> 16:46:49.775 ERROR

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to