AnsweredAssumed Answered

Very Simple Process with Timer Start Event throws Exception

Question asked by ct1 on Jun 28, 2012
Latest reply on Jul 16, 2012 by frederikheremans1
I am seeing the OptimisticLockingException that plagues my use of timers and boundary events.

While trying to use a timer start event, I am getting the OptimisticLockingException.

With this very simple process, I am just trying to start the process at a specified time and log via a script task that it started.  I had no other Process Engines running (although .war files that contain applications that create Process Engines were on the classpath).  I have read and reread the User's Guide and the Activiti In Action sections describing the timers, but still am unable to make even a simple one to work without throwing an exception.

I am running Activiti 5.9, Microsoft SQL Server 2008 R2, jtds-1.2.5, Apache Tomcat 7.0.27 on Windows 7

Would you please have time to point out what I am doing incorrectly?  I am having similar problems using boundary timer events, but I think that if I can get this simple process to work, I might be able to get the boundary timer events to work also.

Here is the BPMN file:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="" xmlns:xsi="" xmlns:activiti="" xmlns:bpmndi="" xmlns:omgdc="" xmlns:omgdi="" typeLanguage="" expressionLanguage="" targetNamespace="">
  <process id="timeStartProc01" name="Timer Start Proc 01">
    <startEvent id="timerProc01Start" name="Timer Proc01 Start ">
[b]      <timerEventDefinition>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy">
      <script><![CDATA[Date timerStarted = new Date();
String timerStartedStr = timerStarted.format('yyyy/MM/dd HH:mm:ss SSS');
print "Timer-Start-Proc 01 logged at $timerStartedStr \n";]]></script>
    <endEvent id="timerStartProc01End" name="tTmer Start Proc01 End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="timerProc01Start" targetRef="scripttask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="scripttask1" targetRef="timerStartProc01End"></sequenceFlow>
  <bpmndi:BPMNDiagram id="BPMNDiagram_timeStartProc01">
    <bpmndi:BPMNPlane bpmnElement="timeStartProc01" id="BPMNPlane_timeStartProc01">
      <bpmndi:BPMNShape bpmnElement="timerProc01Start" id="BPMNShape_timerProc01Start">
        <omgdc:Bounds height="35" width="35" x="110" y="230"></omgdc:Bounds>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55" width="105" x="220" y="220"></omgdc:Bounds>
      <bpmndi:BPMNShape bpmnElement="timerStartProc01End" id="BPMNShape_timerStartProc01End">
        <omgdc:Bounds height="35" width="35" x="390" y="230"></omgdc:Bounds>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="145" y="247"></omgdi:waypoint>
        <omgdi:waypoint x="220" y="247"></omgdi:waypoint>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="325" y="247"></omgdi:waypoint>
        <omgdi:waypoint x="390" y="247"></omgdi:waypoint>

And, this is the activiti.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns=""

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
    <!– Database configurations –>
    <property name="databaseSchemaUpdate" value="true" />
   <property name="databaseType" value="mssql" />
    <property name="jdbcUrl" value="jdbc:jtds:sqlserver://lusr1315:1433/Activiti_DB" />
    <property name="jdbcDriver" value="net.sourceforge.jtds.jdbc.Driver" />
    <property name="jdbcUsername" value="xxxxxxxxxxx" />
    <property name="jdbcPassword" value="yyyyyyyyyyyy" />
    <property name="jobExecutorActivate" value="true" />
   <property name="mailServerHost" value="localhost" />
   <property name="mailServerPort" value="25" />



And this is the exception I get at the time the timer start event should begin:

Jun 28, 2012 12:01:00 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiOptimisticLockingException: TimerEntity[959818] was updated by another t
ransaction concurrently
        at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(
        at org.activiti.engine.impl.db.DbSqlSession.flush(
        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(
        at org.activiti.engine.impl.interceptor.CommandContext.close(
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInte
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(


Thank you.