[
https://issues.apache.org/jira/browse/DELTASPIKE-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13939300#comment-13939300
]
Jörg Mattes commented on DELTASPIKE-542:
----------------------------------------
Thanks.
By the way, another thing that pops up with JdbcJobstore: I'm using
@RunWith(CdiTestRunner.class) for my tests. I've noticed before that the
SchedulerExtension is active in that case, but it didn't bother me much
(although, if I had high-frequent batch jobs that started running in the middle
of my unit test, it would have).
Now that I switched to JdbcJobstore it certainly bothers me because the unit
tests fail:
java.sql.SQLException: Could not retrieve datasource via JNDI url
'java:/comp/env/ics' [...]
at
org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:163)
at
org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108)
at
org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:775)
To solve it, I had to extend CdiTestRunner to set a system property, and then
use a ClassDeactivator that deactivates SchedulerExtension.class if that
property is present. It works for me, but maybe it would be generally advisable
to disable SchedulerExtension when using CdiTestRunner?
Should I open another issue?
> Problem with JdbcJobstore
> -------------------------
>
> Key: DELTASPIKE-542
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-542
> Project: DeltaSpike
> Issue Type: Bug
> Components: Scheduler
> Affects Versions: 0.6
> Environment: Tomcat 7
> Reporter: Jörg Mattes
> Assignee: Gerhard Petracek
> Priority: Minor
> Fix For: 0.7
>
> Attachments: DELTASPIKE-542_first_draft.patch
>
>
> The Deltaspike Scheduler runs fine if Quartz is configured with RAMJobStore.
> But if Quartz runs with JdbcJobstore, QuartzScheduler.registerNewJob() fails
> (stacktrace below). I think a simple check like
> if (this.scheduler.getJobDetail(jobKey) != null) {
> return;
> }
> would already help.
> Caused by: org.quartz.ObjectAlreadyExistsException: Unable to store Job :
> 'DEFAULT.PastDueScanJob', because one already exists with this identification.
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1108)
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport$2.executeVoid(JobStoreSupport.java:1062)
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3703)
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport$VoidTransactionCallback.execute(JobStoreSupport.java:3701)
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3787)
> at
> org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:93)
> at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJobAndTrigger(JobStoreSupport.java:1058)
> at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886)
> at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)
> at
> org.apache.deltaspike.scheduler.impl.QuartzScheduler.registerNewJob(QuartzScheduler.java:107)
> at
> org.apache.deltaspike.scheduler.impl.SchedulerExtension.scheduleJobs(SchedulerExtension.java:126)
> at
> org.apache.deltaspike.scheduler.impl.SchedulerExtension$Proxy$_$$_WeldClientProxy.scheduleJobs(SchedulerExtension$Proxy$_$$_WeldClientProxy.java)
--
This message was sent by Atlassian JIRA
(v6.2#6252)