1 Reply Latest reply on Nov 24, 2008 6:26 AM by Ronald van Kuijk

    Error Creating Timer on Task Instance Create

    John Hurt-Chan Newbie

      Please help. I added a Timer for my Task. But during execution, when the task instance gets created, then it tries to create the Timer, I get this exception...

      DEBUG GraphElement : event 'timer-create' on 'Task(MyTask)' for 'Token(/)'
      DEBUG JobSession : cascading timer save to timer action
      ERROR GraphElement : action threw exception: uninitialized proxy passed to save()
       org.hibernate.PersistentObjectException: uninitialized proxy passed to save()
       at org.hibernate.event.def.DefaultSaveEventListener.reassociateIfUninitializedProxy(DefaultSaveEventListener.java:49)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:59)
       at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
       at org.jbpm.db.JobSession.saveJob(JobSession.java:99)
       at org.jbpm.scheduler.db.DbSchedulerService.createTimer(DbSchedulerService.java:43)
      


      My processdefinition looks like this...

      <task name="MyTask">
       <assignment class="MyAssignmentHandler"></assignment>
       <timer duedate="1 day"><action class="MyActionClass"/></timer>
      </task>


      Its not executing my Action class yet because it can't even get pass creating the Timer. Anyway my Action class looks like this...

      public class TaskReminderEmailNotificationAction implements ActionHandler
      {
       private static final long serialVersionUID = 1L;
       public void execute(ExecutionContext ctx) throws Exception
       {
       TaskInstance taskInstance = ctx.getTaskInstance();
       taskInstance.getActorId();
       EmailNotification.notify(taskInstance);
       }
      }


      And that EmailNotification.notify(TaskInstance) method looks like this...

      public static void notify(TaskInstance taskInstance) throws Exception
      {
       String taskName = taskInstance.getName();
       Object p = ((Object)taskInstance.getContextInstance().getVariable("object"));
       Message msg = new MimeMessage(session);
       Transport.send(msg);
      }


      Any ideas why it can't even create the Timer?