Friday, June 11, 2010

No Hibernate Session bound to thread: in a Grails artifact that's supposed to be having an injected session.

org.quartz.SchedulerException: JobListener 'sessionBinderListener' threw exception: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here [See nested exception:
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here]
    at org.quartz.core.QuartzScheduler.notifyJobListenersWasExecuted(QuartzScheduler.java:1912)
    at org.quartz.core.JobRunShell.notifyJobListenersComplete(JobRunShell.java:355)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:226)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)

Occurred in a Grails application with Quartz-plugin-0.4.1 installed. It was running a cron job. This exception occurred after the last line of code in the Job class executed successfully. It looks like there was a job completion notification that led to a session.flush() call in one of the hibernate classes, where it failed to retrieve the session.

Solution that worked for me:
Upgraded Quartz-plugin to version 0.4.2


Thank you.

No comments:

Post a Comment