Reputation: 157
I've successfully connected to Oracle DB from AdoJobStore. But when I try to add a job I m getting the following exception.
Exception Source: Quartz Exception Method: Void StoreJob(Quartz.Impl.AdoJobStore.ConnectionAndTransactionHolder, Quartz.IJobDetail, Boolean) Exception StackTrace: at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJob(ConnectionAndTransactionHolder conn, IJobDetail newJob, Boolean replaceExisting) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 922 at Quartz.Impl.AdoJobStore.JobStoreSupport.<>c_DisplayClass4.b_3(ConnectionAndTransactionHolder conn) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 848 at Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock[T](String lockName, Func
2 txCallback, Func
3 txValidator) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 3514 at Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock[T](String lockName, Func2 txCallback) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 3432 at Quartz.Impl.AdoJobStore.JobStoreTX.ExecuteInLock[T](String lockName, Func
2 txCallback) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreTX.cs:line 76 at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJobAndTrigger(IJobDetail newJob, IOperableTrigger newTrigger) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\AdoJobStore\JobStoreSupport.cs:line 845 at Quartz.Core.QuartzScheduler.ScheduleJob(IJobDetail jobDetail, ITrigger trigger) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Core\QuartzScheduler.cs:line 718 at Quartz.Impl.StdScheduler.ScheduleJob(IJobDetail jobDetail, ITrigger trigger) in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\StdScheduler.cs:line 262 at TestScheduling.TestScheduleJob.Run() in C:\Users\jwesly\documents\visual studio 2010\Projects\TestScheduling\TestScheduling\TestScheduleJob.cs:line 25 > Exception Message: Couldn't store job: Value does not fall within the expected range.
Here is the code where I've scheduled a Job.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using Quartz.Impl;
using System.IO;
namespace TestScheduling
{
class TestScheduleJob : ITaskScheduler
{
IScheduler sched;
public void Run()
{
try
{
JobDataMap jobdata = new JobDataMap();
jobdata.Add("mtid", "value");
IJobDetail job = JobBuilder.Create<TestJob>().WithIdentity("job1", "group1").UsingJobData(jobdata).RequestRecovery(true).Build();
DateTimeOffset dt = new DateTimeOffset(DateTime.Now.AddSeconds(10));
ISimpleTrigger trig = (ISimpleTrigger)TriggerBuilder.Create().StartAt(dt).WithSimpleSchedule(x => x.WithIntervalInSeconds(10).WithRepeatCount(5)).Build();
ISchedulerFactory sf = new StdSchedulerFactory();
sched = sf.GetScheduler();
sched.ScheduleJob(job, trig);
sched.Start();
}
catch (Exception e)
{
StreamWriter streamWriter = new StreamWriter(new FileStream("C:\\test_schedule_job_error.txt", FileMode.Append));
String exceptionEntry = "Exception Source:\n" + e.Source + "\n" + "Exception Method:\n" + e.TargetSite + "\n" + "Exception StackTrace:\n" + e.StackTrace + "\n" + "Exception Message:\n" + e.Message;
streamWriter.WriteLine(exceptionEntry);
streamWriter.Close();
throw e;
}
finally
{
}
}
public void Stop()
{
if (sched != null)
{
sched.Shutdown();
}
}
}
}
Please help !!!
Upvotes: 0
Views: 755
Reputation: 6884
You should be using OracleDelegate instead of StdAdoDelegate. Define in configuration using
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.OracleDelegate, Quartz";
Upvotes: 0