Thursday, 15 April 2010

java - Quartz-scheduler DB Lock Exception -



java - Quartz-scheduler DB Lock Exception -

we have application using quartz schedule job. uses jdbcjobstore persisting job related meta-data.

hitherto has been using datasource defined in quartz.properties. according upcoming requirement planning move out datasource quartz.properties , provide part of schedulerfactorybean datasource property.

org.springframework.scheduling.quartz.schedulerfactorybean

according schedulerfactorybean documentation:

when using persistent jobs, recommended perform operations on scheduler within spring-managed (or plain jta) transactions. else, database locking not work , might break

and datasource property docs says:

it hence recommended perform operations on scheduler within spring-managed (or plain jta) transactions. else, database locking not work , might break

well, in case breaking. documentation mean "to perform operations on scheduler within spring-managed (or plain jta) transactions".

the datasource have provided not beingness used anywhere else. quartz.properties this:

org.quartz.scheduler.instancename = jobscheduler org.quartz.scheduler.instanceid = pcmlscheduler org.quartz.plugin.shutdownhook.class=org.quartz.plugins.management.shutdownhookplugin org.quartz.plugin.shutdownhook.cleanshutdown = true org.quartz.threadpool.class = org.quartz.simpl.simplethreadpool org.quartz.threadpool.threadcount = 2 org.quartz.threadpool.threadpriority = 4 org.quartz.jobstore.misfirethreshold = 5000 org.quartz.jobstore.class = org.quartz.impl.jdbcjobstore.jobstoretx org.quartz.jobstore.driverdelegateclass = org.quartz.impl.jdbcjobstore.stdjdbcdelegate org.quartz.jobstore.tableprefix = qrtz_

if can context transaction refering can farther 0 downwards on database lock break:

failure obtaining db row lock: no row exists in table qrtz_locks lock named: trigger_access [see nested exception: java.sql.sqlexception: no row exists in table qrtz_locks lock named: trigger_access]

it true qrtz_locks don't have row, should quartz headache manage that. , managing fine, working when datasource provided in quartz.properties.

update: quartz forum, got duplicate of question, per suggestion, adding next rows qrtz_locks solve issue.

insert qrtz_locks values('trigger_access'); insert qrtz_locks values('job_access'); insert qrtz_locks values('calendar_access'); insert qrtz_locks values('state_access'); insert qrtz_locks values('misfire_access');

i don't how reliable this, worked. interesting observation when providing datasource part quary.properties not expecting these rows. providing datasource part schedulerfactorybean, needs these(probably). ideally, if needed, should have taken care quartz itself.

will need expert comment quartz insider/user.

java quartz-scheduler spring-roo

No comments:

Post a Comment