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
This can be resolved by reloading job in executeJob(). There is a line of code for this purpose