我正在從後端Grails應用程序中定期從RESTful服務中獲取信息。爲此,我安裝了Grails Quartz插件。在沒有休眠的情況下使用grails Quartz插件
grails install-plugin quartz
我然後創建使用
grails create-job My
這geneates我與一個cron觸發
static triggers = {
cron name: 'myTrigger', cronExpression: '0 0 * * * ?' // hourly
}
配置在開發環境本地運行的應用程序工作正常一個MyJob文件中的作業,但是,一旦我嘗試構建測試或生產戰爭,觸發器運行時會出現以下異常。
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
正如我不需要數據庫,我試圖消除Hibernate插件as suggested, 但我得到編譯問題一旦Hibernate插件已被刪除:
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;
...
有什麼辦法在沒有Hibernate插件的情況下使用Quartz插件?
如果沒有,最好的辦法是配置Quartz的內存數據庫來使用?(我不關心的此類數據的持久性。)
感謝splix,如果我捆綁在Hibernate罐子然後我可以保留Hibernate插件。我設法通過確保所有數據庫都在內存中來實現它,請參閱我的答案。 – 2010-02-18 11:39:20