0 Replies Latest reply on Mar 29, 2007 5:45 AM by jits_1998

    JobExecutor Problem

    jits_1998

      In JobExecutor, Pending jobs are being retrieved using acquireJobs() by opening new JbpmContext and it is closed in the end.
      acquireJobs() is returning list of acquiredJobs. Job contains lazy node,token and taskIntance

      In executeJob(), When execute() is called on job. It tries call execute() on node, which is a lazy instance. As the session which has retrieved job in acquireJobs() has been closed. Following exception is being thrown.

      Exception in thread "main" ERROR - could not initialize proxy - the owning Session was closed
      org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
      at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
      at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
      at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)

      This can be resolved by reloading job in executeJob(). There is a line of code for this purpose

      jobSession.loadJob(job.getId());
      


      But, here loaded job is not assigned to Job.

      Any comments on how to overcome this problem.