0 Replies Latest reply on Feb 12, 2008 7:55 AM by wanap

    Problem synchronize database with timers

    wanap

      Hello, I've working with timers and I'm very boring of testing things...:(
      I'm working with jbpm 3.1.4.

      My problem is that I've a simple process with 2 activities:

      process-definition
      xmlns="urn:jbpm.org:jpdl-3.1" name="TaskNode TpoDesarrollo">






      <start-state name="Inicio">


      </start-state>






      <!--
      <cancel-timer name='alarma' />
      -->



      <end-state name="Fin">

      </end-state>

      the First action saves the instance process cause i've read that's necessary to solve some problems with the db and timers.

      public class SalvaIDP implements ActionHandler{

      private static final long serialVersionUID = 1L;

      @SuppressWarnings("deprecation")
      public void execute(ExecutionContext executionContext) throws Exception {
      System.out.println("EOOOOO-->Ha pasado por el SALVA IDP");

      try{


      ProcessInstance p=executionContext.getProcessInstance();
      JbpmContext.getCurrentJbpmContext().save(p);

      }catch(Exception e)
      {e.toString();}

      }
      }

      The second action only makes a System.out.println to makes me secure that it's executed.

      public class Traza implements ActionHandler {

      private static final long serialVersionUID = 1L;

      @SuppressWarnings("deprecation")
      public void execute(ExecutionContext executionContext) throws Exception {

      try{
      System.out.println("EOOOOO-->Ha pasado por el Traza!!!");

      }catch(Exception e)
      {e.toString();}



      }

      Here's the error that is displayed on the console...


      13:29:20,446 INFO [STDOUT] EOOOOO-->Ha pasado por el SALVA IDP
      13:29:20,466 WARN [StatefulPersistenceContext] Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==
      13:29:20,487 INFO [[/jbpm]] WARNING: Component _id13 just got an automatic id, because there was no id assigned yet. If this component was created dynamically (i.e. not by a JSP tag) you should assign it an explicit static id or assign it the id you get from the createUniqueId from the current UIViewRoot component right after creation!
      13:29:40,070 INFO [STDOUT] EOOOOO-->Ha pasado por el Traza!!!
      13:29:40,078 INFO [STDOUT] EOOOOO-->Ha pasado por el Traza!!!
      13:29:40,195 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#94]
      at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1625)
      at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2198)
      at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2108)
      at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2364)
      at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
      at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
      at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:850)
      at org.hibernate.impl.SessionImpl.prepareQueries(SessionImpl.java:1043)
      at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1033)
      at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1013)
      at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
      at org.jbpm.db.SchedulerSession.cancelTimersForProcessInstance(SchedulerSession.java:169)
      at org.jbpm.scheduler.db.DbSchedulerService.cancelTimersByProcessInstance(DbSchedulerService.java:55)
      at org.jbpm.graph.exe.ProcessInstance.end(ProcessInstance.java:275)
      at org.jbpm.graph.exe.ProcessInstance$$FastClassByCGLIB$$5167cc59.invoke()
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
      at org.jbpm.graph.exe.ProcessInstance$$EnhancerByCGLIB$$8a87710f.end()
      at org.jbpm.graph.exe.Token.notifyParentOfTokenEnd(Token.java:261)
      at org.jbpm.graph.exe.Token.end(Token.java:233)
      at org.jbpm.graph.exe.Token.end(Token.java:193)
      at org.jbpm.graph.node.EndState.execute(EndState.java:46)
      at org.jbpm.graph.def.Node.enter(Node.java:316)
      at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke()
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
      at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$78a94010.enter()
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:382)
      at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke()
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
      at org.jbpm.graph.node.State$$EnhancerByCGLIB$$4ee1586a.leave()
      at org.jbpm.graph.exe.Token.signal(Token.java:174)
      at org.jbpm.graph.exe.Token.signal(Token.java:137)
      at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke()
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
      at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$979a7a4.signal()
      at org.jbpm.scheduler.exe.Timer.execute(Timer.java:118)
      at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread.java:118)
      at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:70)
      13:29:40,202 ERROR [SchedulerSession] org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.graph.exe.Token#94]


      Can somebody help me???

      Sorry my english, I'm a spanish student and I've not much idea of speaking english :(
      Thanks for your attention