grails / grails-quartz Goto Github PK
View Code? Open in Web Editor NEWThis project provides integration of the Quartz scheduling framework into the Grails Framework
Home Page: http://grails.org/plugin/quartz
License: Apache License 2.0
This project provides integration of the Quartz scheduling framework into the Grails Framework
Home Page: http://grails.org/plugin/quartz
License: Apache License 2.0
The Link in the documentation to Burt's Grails2 clustering example does not work anymore.
http://docs.codehaus.org/download/attachments/78053/clustering_sample.tar.gz?version=1
I have a problem, that quartz 2.0.1 stop working and did not run job (seem like my changes in grails app or env somehow affect quartz). I try to update to latest 2.0.5 and I see some problems:
environments:
development:
dataSource:
...
quartz:
autoStartup: false
pluginEnabled: true
jdbcStore: false
Seems like 2.0.5 catch this settings, because it does not use jdbcStore now, but 2.0.1 can not catch values of settings. By default 2.0.1 works with RamStore, but I set setting with name 'jdbcStore' and does not matter what kind of value I set (false or true), it starts to use jdbcStore. May be I'm doing something wrong because I have read about some files that should be created QuatzConfig.groovy and quartz.properties and there are some mess with configuration of plugin. May be it is worth to show how to configure plugin in a right way for current version in readme?
for tasks for last day of the month
I'm using grails 2.4.4, quartz plugin 1.0.2
The job is not executing at all.
class IndexDataJob {
def concurrent = false
static triggers = {
simple repeatInterval: 500l, startDelay:240000 // execute job once in 45 seconds
}
def dataIndexerService
def execute()
{
...
}
}
Hello
I'm testing grails 3.3.0.M1 and 3.3.0RC1
and found it's not support disble concurrent job of quartz
compile 'org.grails.plugins:quartz:2.0.12'
disable concurrent job didn't work
def concurrent = false
I test with code
class TestJob {
def concurrent = false
static triggers = {
cron name: 'myTrigger', cronExpression: "0/5 * * * * ?"
}
def execute() {
// execute job
log.error('Start:' + new Date())
sleep(8000)
log.error('End:' + new Date())
}
}
When I run with grails 3.2.9 , it run fine , but if I run with newer version ,
I can not disable concurrent job
If someone deletes job class, but it's still scheduled, user would like the plugin to scan for these cases and remove them and log an error message.
Currently, it seems one needs to create the quartz tables manually when using jdbcStore = true
. It would be great if the plugin supports database-migration, to create the quartz table migrations automatically with dbm-gorm-diff
, like the database-migration plugin does itself to create the liquibase tables.
When I use 'compile 'org.grails.plugins:quartz:2.0.3' (or 2.0.4) there is no any log on console during app start whereas 2.0.2 logs that plugin is started. But however that may be no jobs are started with version > 2.0.2.
Logger settings are logger("org.quartz", DEBUG)
But however that may be I cannot configure 2.0.2 also. It logs that it started but I see this:
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
What does it meant 'NOT STARTED'?
Also I noticed that some jobs were started, some were not. Which started they run at incorrect time or not run at all, although everything was made according to docs. I added QuartzGrailsPlugin.groovy file, added to application.groovy and application.yml
quartz {
autoStartup = true
//exposeSchedulerInRepository=true
}
but all these seems to be wrong.
Grails 3.1.1 Quartz Plugin 2.0.1-2.0.7
When a job is scheduled instantly (eg resuming from a persistent store) It will fail without a Hibernate Session. Subsequent runs do have a Hibernate session -
ERROR grails.plugins.quartz.listeners.ExceptionPrinterJobListener - Exception occurred in job: Grails Job org.quartz.JobExecutionException: org.hibernate.HibernateException: No Session found for current thread
We tried to set the loadAfter
, but it did not resolve the issue. 0e2a909
DEBUG quartz.QuartzGrailsPlugin - Registering hibernate SessionBinderJobListener
INFO org.grails.plugins.datasource.TomcatJDBCPoolMBeanExporter - Registering beans for JMX exposure on startup
ERROR grails.plugins.quartz.listeners.ExceptionPrinterJobListener - Exception occurred in job: Grails Job
^ exception before the app starts
Grails application running at http://localhost:8080 in environment: development
DEBUG grails.plugins.quartz.listeners.SessionBinderJobListener - Persistence session is flushed.
DEBUG grails.plugins.quartz.listeners.SessionBinderJobListener - Persistence session is opened.
^ SessionBinderJobListener
working as expected after app is running
I don't see this behavior in Grails 2.5.3 with Quartz Plugin 1.0.2
allow user to flush all quartz tables when in jdbc mode for development/test purposes on app startup.
Using Grails 3.0.15. From Quartz calling Grails Service, which explicitly calls domain class withTransaction. Getting error "No Session found for current thread". See stack traceback below:
2016-08-23 14:43:37.147 [QuartzScheduler2_Worker-12] ERROR com.the.company.name.TheQuartzJob - _execute_closure2 threw unexpected throwable (Heuristic completion: outcome state is mixed; nested exception is org.springframework.orm.hibernate4.HibernateSystemException: No Session found for current thread; nested exception is org.hibernate.HibernateException: No Session found for current thread). Marking job as failed
org.springframework.transaction.HeuristicCompletionException: Heuristic completion: outcome state is mixed; nested exception is org.springframework.orm.hibernate4.HibernateSystemException: No Session found for current thread; nested exception is org.hibernate.HibernateException: No Session found for current thread
at org.grails.transaction.ChainedTransactionManager.commit(ChainedTransactionManager.java:174) ~[ChainedTransactionManager.class:3.0.11]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:150) ~[TransactionTemplate.class:4.1.8.RELEASE]
at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93) ~[GrailsTransactionTemplate.class:3.0.11]
at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:822) ~[GormStaticApi.class:na]
at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:722) ~[GormStaticApi.class:na]
at org.grails.datastore.gorm.GormStaticApi$withTransaction$2.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[CallSiteArray.class:2.4.5]
at org.grails.datastore.gorm.GormStaticApi$withTransaction$2.call(Unknown Source) ~[na:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper.withTransaction(GormEntity.groovy:724) ~[GormEntity$Trait$Helper.class:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper$withTransaction$1.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[CallSiteArray.class:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[AbstractCallSite.class:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) ~[AbstractCallSite.class:2.4.5]
at com.the.company.name.directory.Contact.withTransaction(Contact.groovy) ~[Contact.class:na]
at com.the.company.name.directory.Contact$withTransaction$5.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[CallSiteArray.class:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[AbstractCallSite.class:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[AbstractCallSite.class:2.4.5]
Have tried:
The project has similar code from Quartz calling withTransaction() successfully. No idea what is different about this one and why this one does not work.
I try to use 2.0.5 and if fails by default:
org.springframework.context.ApplicationContextException: Failed to start bean 'quartzScheduler'; nested exception is org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table 'localShema.QRTZ_LOCKS' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'localShema.QRTZ_LOCKS' doesn't exist]
It needs some database layout, but did not create it by itself, also I can not find any sql script to create all needed db stuff.
Hi,
I'm getting bellow error while trying to use SecurityUtils.subject?.principal
in code:
No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
org.apache.shiro.SecurityUtils in getSecurityManager at line 123
org.apache.shiro.subject.Subject$Builder in <init> at line 627
org.apache.shiro.SecurityUtils in getSubject at line 56
(The code is common for jobs and user iterface.)
I have found possible workaround: http://grails.1312388.n4.nabble.com/Shiro-subject-on-quartz-job-td2280109.html but I would like to have something out of the box, something that will work for all of my jobs.
Does any of you know an sensible way of injectingSecurityManager
orSubject
in the thread context of all jobs?
Environment:
Grails 2.5.4
Quartz 1.0.2
Tomcat 7
JDK 8
The application fails on startup (Failed to introspect class: class cronoshare.PrivateViewsInterceptor), but without interceptors all is working well.
Stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplicationPostProcessor' defined in cronoshare.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplicationPostProcessor' defined in cronoshare.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at grails.boot.GrailsApp.run(GrailsApp.groovy:52) [grails-core-3.0.9.jar:3.0.9]
at grails.boot.GrailsApp.run(GrailsApp.groovy:52)
at grails.boot.GrailsApp.run(GrailsApp.groovy:330) [grails-core-3.0.9.jar:3.0.9]
at grails.boot.GrailsApp.run(GrailsApp.groovy:330)
at grails.boot.GrailsApp.run(GrailsApp.groovy:319) [grails-core-3.0.9.jar:3.0.9]
at grails.boot.GrailsApp.run(GrailsApp.groovy:319)
at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-3.0.9.jar:3.0.9]
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.5.jar:2.4.5]
at cronoshare.Application.main(Application.groovy:8)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [groovy-2.4.5.jar:2.4.5]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
at cronoshare.Application.main(Application.groovy:8) [main/:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
... 22 more
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
Caused by: org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
... 22 common frames omitted
at grails.core.ArtefactHandlerAdapter.isArtefact(ArtefactHandlerAdapter.java:129)
Caused by: org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class cronoshare.PrivateViewsInterceptor
at grails.core.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsApplication.java:243)
at grails.core.ArtefactHandlerAdapter.isArtefact(ArtefactHandlerAdapter.java:129) ~[grails-core-3.0.9.jar:3.0.9]
at grails.core.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:687)
at grails.core.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsApplication.java:243) ~[grails-core-3.0.9.jar:3.0.9]
at grails.boot.config.GrailsApplicationPostProcessor.performGrailsInitializationSequence(GrailsApplicationPostProcessor.groovy:104)
at grails.core.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:687) ~[grails-core-3.0.9.jar:3.0.9]
at grails.boot.config.GrailsApplicationPostProcessor.performGrailsInitializationSequence(GrailsApplicationPostProcessor.groovy:104) ~[grails-core-3.0.9.jar:3.0.9]
at grails.boot.config.GrailsApplicationPostProcessor.initializeGrailsApplication(GrailsApplicationPostProcessor.groovy:91)
at grails.boot.config.GrailsApplicationPostProcessor.initializeGrailsApplication(GrailsApplicationPostProcessor.groovy:91) ~[grails-core-3.0.9.jar:3.0.9]
at grails.boot.config.GrailsApplicationPostProcessor.(GrailsApplicationPostProcessor.groovy:78)
at grails.boot.config.GrailsApplicationPostProcessor.(GrailsApplicationPostProcessor.groovy:78) ~[grails-core-3.0.9.jar:3.0.9]
at grails.boot.config.GrailsAutoConfiguration.grailsApplicationPostProcessor(GrailsAutoConfiguration.groovy:59)
at grails.boot.config.GrailsAutoConfiguration.grailsApplicationPostProcessor(GrailsAutoConfiguration.groovy:59) ~[grails-core-3.0.9.jar:3.0.9]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) ~[springloaded-1.2.4.RELEASE.jar:1.2.4.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 23 more
... 23 common frames omitted
Caused by: java.lang.ExceptionInInitializerError
Caused by: java.lang.ExceptionInInitializerError: null
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_31]
at java.lang.Class.forName(Class.java:344)
at java.lang.Class.forName(Class.java:344) ~[na:1.8.0_31]
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:68)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:68) ~[groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:65)
at org.codehaus.groovy.runtime.callsite.CallSiteArray$1.run(CallSiteArray.java:65) ~[groovy-2.4.5.jar:2.4.5]
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_31]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:65)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:65) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:162)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:162) [groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.5.jar:2.4.5]
at java_lang_Class$getName.call(Unknown Source)
at java_lang_Class$getName.call(Unknown Source) ~[na:na]
at grails.plugins.quartz.JobArtefactHandler.isArtefactClass(JobArtefactHandler.groovy:62)
at grails.plugins.quartz.JobArtefactHandler.isArtefactClass(JobArtefactHandler.groovy:62) ~[quartz-2.0.5.jar:na]
at grails.core.ArtefactHandlerAdapter.isArtefact(ArtefactHandlerAdapter.java:125)
at grails.core.ArtefactHandlerAdapter.isArtefact(ArtefactHandlerAdapter.java:125) ~[grails-core-3.0.9.jar:3.0.9]
... 35 more
... 35 common frames omitted
Caused by: java.lang.IllegalArgumentException: GrailsApplication not found
Caused by: java.lang.IllegalArgumentException: GrailsApplication not found
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at grails.util.Holders.getGrailsApplication(Holders.java:129)
at grails.util.Holders.getGrailsApplication(Holders.java:129) ~[grails-core-3.0.9.jar:3.0.9]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_31]
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) ~[springloaded-1.2.4.RELEASE.jar:1.2.4.RELEASE]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1847) ~[groovy-2.4.5.jar:2.4.5]
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3737) ~[groovy-2.4.5.jar:2.4.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:51) ~[groovy-2.4.5.jar:2.4.5]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296) [groovy-2.4.5.jar:2.4.5]
at cronoshare.PrivateViewsInterceptor.(PrivateViewsInterceptor.groovy) ~[main/:na]
... 46 common frames omitted
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1847)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3737)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at cronoshare.PrivateViewsInterceptor.(PrivateViewsInterceptor.groovy)
... 46 more
Grails 3.0.11 / org.grails.plugin:quartz:2.0.4
In QuartzGrailsPlugin:
boolean pluginEnabled = grailsApplication?.config?.quartz?.pluginEnabled
boolean autoStart = grailsApplication?.config?.quartz?.autoStartup
If value is not set then this results in false (empty set -> false). This contradicts the documented defaults of these two properties.
Once I set both options explicitly to true it will fail again:
In line 89:
if (grailsApplication?.config?.quartz?.purgeQuartzTablesOnStartup?.toBoolean()==true) {
The config object apparently does no longer return null if a property is not set. Instead a empty Map is returned. There is no toBoolean() on that. I propose to remove the toBoolean() call. This way it will default to false because [:] == true
equals false.
To sum up, I had to set the following options although there should be sane default values:
quartz:
autoStartup: true
pluginEnabled: true
purgeQuartzTablesOnStartup: false
I created a brand new grails app and tried this plugin. But it doesnot run at all.
static triggers = { simple repeatInterval: 1000 }
void execute() { println "Job run!" } }
Grails Version: 3.1.6
Groovy Version: 2.4.6
JVM Version: 1.8.0_91
Plugin version: 2.0.1
Description: When setting up a simple job an NPE is thrown because the internalJobArtefact.group is null. The underlying issue looks to be a missing property exception.
Steps to reproduce:
Set up a simple job:
class MyJob {
def group = "Reporting Group"
def description = "Simple Description"
def execute(context) {
println context.mergedJobDataMap.foo
}
}
From a controller call the triggerNow method (or any way of scheduling a job)
MyJob.triggerNow([foo: "it just works"])
Results in the NPE being thrown and the job not being executed.
Hi
When i let quartz start automatically everything works fine and i am able to use the myjob.schedule
method...
I am trying to start the scheduler at the end of my bootstrap...
I have tried several different ways, and although some seems to be working i get persistence exceptions when i am trying to schedule a job.
I would like to find out what is the proper way to start it in my bootstrap.
I can post exactly what i did, but i prefer to try the proper way first.
Thanks
Offer Baruch
Just upgraded to Grails 2.4.3 & also upgraded quartz to 1.0.2 & getting this exception. The configuration seems fine:
quartz {
jdbcStore = false
autoStartup = true
}
but upon running the application it throws down this:
Caused by: org.quartz.SchedulerConfigException: DataSource name not set.
at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:638)
at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:57)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1333)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:597)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
... 25 more
Hi,
On our project we decided to give version 2.0.12 a go (up from 2.0.8) and, from the logs of it, the jobs are not started.
application.yml:
quartz:
autoStartup: true
jdbcStore: false
One of the job triggers & config:
static triggers = {
simple name: 'ldapTrigger', startDelay: 30 * 1000, repeatInterval: 10 * 60 * 1000
}
String group = 'LdapGroup'
String description = 'Synchronizes LDAP users into local cache'
Boolean sessionRequired = Boolean.FALSE
Boolean concurrent = Boolean.FALSE
Startup log related to Quartz:
2017-04-07 19:25:01.284 [main] INFO [][] o.q.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor
2017-04-07 19:25:01.441 [main] INFO [][] o.q.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2017-04-07 19:25:01.441 [main] INFO [][] org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.2.3 created.
2017-04-07 19:25:01.460 [main] INFO [][] org.quartz.simpl.RAMJobStore - RAMJobStore initialized.
2017-04-07 19:25:01.461 [main] INFO [][] org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.3) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
2017-04-07 19:25:01.461 [main] INFO [][] o.q.impl.StdSchedulerFactory - Quartz scheduler 'quartzScheduler' initialized from an externally provided properties instance.
2017-04-07 19:25:01.461 [main] INFO [][] o.q.impl.StdSchedulerFactory - Quartz scheduler version: 2.2.3
2017-04-07 19:25:01.463 [main] INFO [][] org.quartz.core.QuartzScheduler - JobFactory set to: grails.plugins.quartz.GrailsJobFactory@57554f95
Will also try with 2.0.11 and get back with result...
Couldn't get any of the quartz 2.x version for Grails 3
build.gradle
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://repo.grails.org/grails/plugins" }
maven { url "http://dl.bintray.com/grails/plugins" }
}
...
compile "org.grails.plugins:quartz:2.0.9"
Error message:
Error:Could not find quartz.zip (org.grails.plugins:quartz:2.0.9).
Searched in the following locations:
https://repo.grails.org/grails/core/org/grails/plugins/quartz/2.0.9/quartz-2.0.9.zip
Error:Could not find quartz.zip (org.grails.plugins:quartz:2.0.9).
Searched in the following locations:
http://dl.bintray.com/grails/plugins/org/grails/plugins/quartz/2.0.9/quartz-2.0.9.zip
Adding 'org.grails.plugins:quartz:2.0.1' as dependency to my grails 3.0.4 project will not run any job at all.
After changing to 'org.grails.plugins:quartz:2.0.5' it works as expected. Maybe the part of build.gradle should be updated for the latest branch accordingly.
When stopping an app (stop-app in development) the Quartz jobs do not stop.
class DomainNameJob {
static triggers = {
simple repeatInterval: 5000l // execute job once in 5 seconds
}
def execute() {
// execute job
log.debug("Domain name job processing");
}
}
Output from an application here:
| Server running. Browse to http://localhost:8080/Verity
| Application loaded in interactive mode. Type 'stop-app' to shutdown.
| Enter a script name to run. Use TAB for completion:
2015-10-14 16:46:17,164 [quartzScheduler_Worker-2] DEBUG account.DomainNameJob - Domain name job processing
2015-10-14 16:46:22,163 [quartzScheduler_Worker-3] DEBUG account.DomainNameJob - Domain name job processing
2015-10-14 16:46:27,164 [quartzScheduler_Worker-4] DEBUG account.DomainNameJob - Domain name job processing
grails>
| Server Stopped
2015-10-14 16:46:32,161 [quartzScheduler_Worker-5] DEBUG account.DomainNameJob - Domain name job processing
2015-10-14 16:46:37,160 [quartzScheduler_Worker-6] DEBUG account.DomainNameJob - Domain name job processing
2015-10-14 16:46:42,162 [quartzScheduler_Worker-7] DEBUG account.DomainNameJob - Domain name job processing
Grails 2.5.1 - latest from branch 1.x.
So I'm using 2.0.5
snapshot and I'm getting error:
Caused by: groovy.lang.MissingMethodException: No signature of method: static org.grails.config.NavigableMap.toBoolean() is applicable for argument types: () values: []
Possible solutions: asBoolean(), asBoolean(), toSorted()
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1498)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1484)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:893)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:168)
at org.grails.config.NavigableMap$NullSafeNavigator.methodMissing(NavigableMap.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:936)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1259)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1212)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:80)
at quartz.QuartzGrailsPlugin.scheduleJob(QuartzGrailsPlugin.groovy:231)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
The problem is in file QuartzGrailsPlugin
line 31 https://github.com/grails-plugins/grails-quartz/blob/master/src/main/groovy/quartz/QuartzGrailsPlugin.groovy#L231 when I do not have in my application.yml
Quartz config.
Currently when the jobs are started the config is not available. Due to this the triggers cannot be made a part of the config and needs to be either hard-coded or manually read from a config file.
It would be good if config is available when triggers are evaluated.
Java 1.8
Grails 3.0.12
removed all cache files from anywhere I can think of
New project: grails create-app junk1
add compile 'org.grails.plugins:quartz:2.0.5' to build.gradle
grails
create-job Testme88
Edit Testme88Job and put:
1 package testme66
2
3 class Testme88Job {
4 static triggers = {
5 simple name: 'mySimpleTrigger', startDelay:5000, repeatCount: 1
6 }
7
8 def execute() {
9 log.debug("Domain name job processing");
10
11 }
12 }
All seems good.
Now
run-app
Lots of errors, This is the start of them.
Grails 3 / quartz 2.05 / java 1.8 / groovy 2.4.5
I am at a loss why I cannot get jobs to work.
Honestly grails 2.4.5 I do not have any issues and may not even upgrade to grails 3 as it seems to be a completely different animal.
Any ideas ?
From scratch out of the box does not seem to work at all.
HealthIndicatorAutoConfiguration.DiskSpaceHealthIndicatorConfiguration
- matched (OnPropertyCondition)
Exception in thread "main" org.springframework.context.ApplicationContextException: Failed to start bean 'quartzScheduler'; nested exception is org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table "QRTZ_LOCKS" not found; SQL statement:
SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE [42102-176] [See nested exception: org.h2.jdbc.JdbcSQLException: Table "QRTZ_LOCKS" not found; SQL statement:
SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE [42102-176]]]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:772)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:139)
getting bufferoverflow deleted with openjdk 1.7
Snippet of the Job
def concurrent = false
def description = "Does stuff."
static triggers = {
cron name: 'cronTrigger', startDelay: 10000, cronExpression: "0 0 8 * * * *" //8AM Every day
}
void execute() {}
Exception thrown:
Error loading plugin manager: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass (Use --stacktrace to see the full trace)
The exception is not thrown when using a simple trigger.
In QuartzGrailsPlugin, only if pluginEnabled
and autoStart
is both true then scheduleJob
is run. The problem is that scheduleJob
not only schedules the job but also configures the SessionBinderJobListener.
In consequence, if you activate grails later after startup (there is a grails plugin for quartz that provides an UI for that) then the jobs won't have a Session when they are triggered.
// The session listener if is needed
if (hasHibernate && jobClass.sessionRequired && hasJdbcStore) {
SessionBinderJobListener listener = ctx.getBean(SessionBinderJobListener.NAME)
....
Currently, it seems one needs to create the quartz tables manually. It would be great if the plugin supports database-migration, to create the quartz table migrations automatically with dbm-gorm-diff, like the database-migration plugin does itself to create the liquibase tables.
Hi There,
I'm using compile "org.grails.plugins:quartz:2.0.0" in build.gradle
Trying to changes the default threadCount from 10 to 20.
Having quartz.properties with following settings placed under grails-app/config.
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=20
Unfortunately the application logs still saying 10 threads.
2016-02-04 21:23:38 INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.1) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
Does anyone had the same issue? Appreciate your help.
Jobs are starting before application is fully running. This tends to cause the application startup time to take longer than necessary and also can cause jobs to access code not fully ready for access. It may be advisable to move the autoStartup features of the Quartz plugin to a Bootstrap class instead of in the Plugin class events.
Followed the document to create the job but not working in Grails 3.2.0.
Inspired by the spring security oauth2 provider plugin.
I think it would be nice to have a GormJobStore that used GORM objects instead of using a JDBC directly. It would also have the benefit of integrating with the database-migration plugin using dbm-gorm-diff.
It would be a little tedious but not too difficult. We could use JobStoreSupport as a guide.
Job:
class ExampleJob {
def someService
void execute() {
someService.method()
}
}
Service:
@Transactional
class SomeService {
@Transactional(readOnly=true)
def method() {
// do lots work
}
}
I would expect method
called from the job would be a readOnly transaction. I only noticed it wasn't while I had sql logging on and noticed a bunch of dirty checks/updates.
It seems to ignore the annotation, adding Propagation.REQUIRES_NEW
was not honored either.
If this same someService.method()
is called from a controller it was readOnly as expected.
Only way to work around it was to not use the annotation but do Domain.withNewTransaction(readOnly: true) { .work. }
Currently you cannot set a timezone on cron triggers for the Quartz 1.x version of the plugin.
Grails 3.1.9 (not reproducible on previous version)...
Simple job defined, which is calling a service with @transactional annotation.
[XXXXXX] 17:48:43.463 INFO org.quartz.core.JobRunShell.run:207 - Job GRAILS_JOBS.XXXXX.threw a JobExecutionException:
org.quartz.JobExecutionException: java.lang.IllegalStateException: No transactionManager was specified. Using @transactional or @Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method.
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.lang.IllegalStateException: No transactionManager was specified. Using @transactional or @Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method.
at grails.transaction.GrailsTransactionTemplate.(GrailsTransactionTemplate.groovy:60)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1075)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at XXXXXX.execute(XXXXXXX.groovy:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
... 2 common frames omitted
grails clean did not help, no errors.
Can I give any information, or else all of this problem?
I try to prevent start of the scheduler but it starts anyway.
application.groovy
quartz.autoStartup = false
doesn't work.
After the upgrade from Grails 3.0.11 to 3.1.4 on my plugin, I noticed that the hibernate session is not reset on the Quartz worker thread when the thread is re-used. This resulted in a lot of exceptions: 'org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction' after the 11th run.
The thread pool used threads 1-10 fine, but when the job ran a 11th time, we hit the exception. The thread was still bound to the original hibernate session that had stale data. The domain object's version was the same as it was when the thread was first used.
As a temporary work around, I added this at the end of the job:
grailsApplication?.mainContext?.sessionFactory?.currentSession?.clear()
This probably is not a huge problem if I have to leave it in the Job, but it would be great if the plugin cleared the session. Also, I am using the RAM store. I assume the JDBC Store might behave differently. My only configuration option in application.yml for this plugin is:
quartz.jdbcStore: false
(I suspect something in thread handling changed in Grails 3.1.x, but I could not find an obvious issue).
The error indicates that the RAMJobStore tables are not created at startup. I'm using Grails 3.1.1. I tried plugin version 2.0.5 - 2.0.8 with the same failure. Plugin version 2.0.4 is working. Appreciate your help with this.
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.context.ApplicationContextException: Failed to start bean 'quartzScheduler'; nested exception is org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table "QRTZ_LOCKS" not found; SQL statement:
SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE [42102-190] [See nested exception: org.h2.jdbc.JdbcSQLException: Table "QRTZ_LOCKS" not found; SQL statement:
SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'quartzScheduler' AND LOCK_NAME = ? FOR UPDATE [42102-190]]]
I'm migrating a project to Grails3 and just wasted a lot of time figuring out why am I getting really strange errors. Just in case somebody encounters exception like: PSQLException: Bad value for type long : \x
it means that your org.quartz.jobStore.driverDelegateClass
property is incorrect or not set all. In my case it was the second thing.
After debugging and comparing the code of plugin in v1
and v2
I've came to a conclusion that those lines of code are missing in v2
:
https://github.com/grails-plugins/grails-quartz/blob/v1.0/QuartzGrailsPlugin.groovy#L398-L400
v2 for reference : https://github.com/grails-plugins/grails-quartz/blob/master/src/main/groovy/quartz/QuartzGrailsPlugin.groovy#L159-L168
So if anybody had a config like that when using plugin v1
and Grails 2.x:
quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
exposeSchedulerInRepository = false
props {
scheduler.skipUpdateCheck = true
scheduler.idleWaitTime = 1000
threadPool.'class' = 'org.quartz.simpl.SimpleThreadPool'
threadPool.threadCount = 10
threadPool.threadPriority = 7
jobStore.misfireThreshold = 60000
jobStore.'class' = 'org.quartz.impl.jdbcjobstore.JobStoreTX'
jobStore.driverDelegateClass = 'org.quartz.impl.jdbcjobstore.PostgreSQLDelegate'
jobStore.useProperties = false
jobStore.tablePrefix = 'QRTZ_'
jobStore.isClustered = true
jobStore.clusterCheckinInterval = 5000
plugin {
triggerHistory.class = 'org.quartz.plugins.history.LoggingTriggerHistoryPlugin'
...
}
}
}
he should remove the props { }
outer block and things should get better.
It makes me wonder why was this done like that in v1
? ๐ค
groovy construction from QuartzGrailsPlugin.groovy "quartzProperties['org.quartz.autoStartup'] as boolean" always evaluates to true.
As a result of this "wonderful" and "modern" groovy usage I can't start quartz scheduler manually:
if (quartzProperties['org.quartz.autoStartup']) {
autoStartup = quartzProperties['org.quartz.autoStartup'] as boolean // evaluates to true
}
I'm sure this is a more complex task than it sounds, but the basic idea mightbe something like:
(application.yml):
quartz;
triggers:
- name: 'cronTrigger1'
type: cron
cronExpression: '0 0 2 * * ?'
- name: 'cronTrigger2'
type: cron
cronExpression: '0 0 12 * * 1'
- name: 'simpleTrigger1'
type: simple
startDelay:10000,
repeatInterval: 30000,
repeatCount: 10
Then perhaps the Job would look like:
class MyJob {
static triggers = {
configured name: 'cronTrigger1'
}
}
After upgrading to Grails 3 and quartz 2.0.0, we are getting this exception anytime one of our jobs tries to access grailsApplication:
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at grails.web.api.WebAttributes$Trait$Helper.currentRequestAttributes(WebAttributes.groovy:45)
at grails.web.api.WebAttributes$Trait$Helper$currentRequestAttributes.call(Unknown Source)
at com.triu.system.MailRetryJob.currentRequestAttributes(MailRetryJob.groovy)
at grails.web.api.WebAttributes$Trait$Helper.getGrailsAttributes(WebAttributes.groovy:54)
at grails.web.api.WebAttributes$Trait$Helper$getGrailsAttributes$2.call(Unknown Source)
at com.triu.system.MailRetryJob.getGrailsAttributes(MyJob.groovy)
at grails.web.api.WebAttributes$Trait$Helper.getGrailsApplication(WebAttributes.groovy:134)
at grails.web.api.WebAttributes$Trait$Helper$getGrailsApplication$6.call(Unknown Source)
at com.triu.system.MailRetryJob.getGrailsApplication(MailRetryJob.groovy)
at com.triu.system.process.ManagedProcess.getProperty(ManagedProcess.groovy)
at com.triu.system.MailRetryJob.executeJob(MailRetryJob.groovy:69)
at com.triu.system.process.ManagedJob$_execute_closure1.doCall(ManagedJob.groovy:73)
It looks like the problem is that QuartzJob implements the new WebAttributes trait but apparently it assumes that properties will be available via RequestContextHolder
. I'm not really sure why a quartz job would ever satisfy this constraint since it runs in a separate thread.
We actually inject grailsApplication
into our Jobs that need them but the trait is causing that injection to be ignored in favor of the WebAttributes getter.
the autostartup=false property not working in quartz {} block. It starts no matter what.
autoStartup = false should just prevent the scheduler from starting but register and schedule jobs as it used to. currently no job is defined/scheduled at all if autoStartup=false
ref. https://github.com/grails-plugins/grails-quartz/blob/master/src/main/groovy/quartz/QuartzGrailsPlugin.groovy#L285
Added the dependency and created a job. Added a print on the execute and nothing comes out. Not sure what is going on.
compile 'org.grails.plugins:quartz:2.0.1'
package com.cabolabs.notes
class CommitJob {
static triggers = {
simple repeatInterval: 5000l // execute job once in 5 seconds
}
def execute()
{
println "job"
// execute job
String PS = System.getProperty("file.separator")
def outbox = new File("documents" +PS+ "pending")
outbox.eachFile { f ->
println "File to commit "+ f.name
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.