I am working on a backend Grails application that pulls information periodically from a RESTful service. To do this I installed the Grails Quartz plugin.
grails install-plugin quartz
I then created a job using
grails create-job My
which geneates a MyJob file which I configured with a cron trigger
static triggers = {
cron name: 'myTrigger', cronExpression: '0 0 * * * ?' // hourly
}
Running the application locally in the dev environment works correctly, however once I try to build a testing or production war I get the following exception when the trigger is run.
2010-02-18, 00:04:32 ERROR org.codehaus.groovy.grails.web.context.GrailsContextLoader - Error occurred shutting down plug-in manager: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler': Cannot resolve reference to bean 'sessionBinderListener' while setting bean property 'jobListeners' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBinderListener': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException : Access is denied: Session is closed
As I don't require a database, I tried removing the Hibernate plugin as suggested in http://stackoverflow.com/questions/1343967/can-i-configure-grails-with-no-datasource
However I get compilation problems once the Hibernate plugin has been removed:
Running script C:\Downloads\grails-1.2.1\scripts\RunApp.groovy
Environment set to development
[groovyc] Compiling 18 source files to C:\Projects\myapp\target\classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac.
[groovyc] ...\myapp\plugins\quartz-0.4.1\src\java\org\codehaus\groovy\grails\plugins\quartz\listeners\SessionBinderJobListener.java:19: package org.hibernate does not exist
[groovyc] import org.hibernate.FlushMode;
...
Is there anyway to use the Quartz plugin without the Hibernate plugin?
If not, would the best idea be to configure an in-memory database for Quartz to use? (I'm not concerned with the persistence of any of this data.)