我正在尝试使用 AdoJobStore 来使用 Quartz API 安排作业。
这是应用程序配置文件的内容(作为 Windows 服务的一部分提供)。
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="quartz"
type="System.Configuration.NameValueSectionHandler" />
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="ServerScheduler" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="2" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.clustered" value="true" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
<add key="quartz.jobStore.dataSource" value="quartzDS" />
<add key="quartz.dataSource.quartzDS.connectionString" value="Data Source=LocalDB;User ID=wesly;Password=XXXXX" />
<add key="quartz.dataSource.quartzDS.provider" value="OracleClient-20 " />
</quartz>
</configuration>
当我启动我的 Windows 服务时,我收到以下错误格式并写入日志:
Exception Source: Quartz Exception Method:Quartz.IScheduler Instantiate() Exception StackTrace: at Quartz.Impl.StdSchedulerFactory.Instantiate() in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs:line 1044 at Quartz.Impl.StdSchedulerFactory.GetScheduler() in c:\Work\OpenSource\Quartz.NET\quartznet\src\Quartz\Impl\StdSchedulerFactory.cs:line 1118 at SampleJobScheduling.ScheduleJob.Run() in C:\Users\jwesly\documents\visual studio 2010\Projects\SampleJobScheduling\SampleJobScheduling\ScheduleJob.cs:line 25 Exception Message: Could not Initialize DataSource: quartzDS
我使用的是 Oracle 11g 快捷版。模式是 WESLY
请帮忙!!!
最佳答案
我在使用 quartz.net 版本 3 后遇到了这个异常。
根据BREAKING CHANGES第 3 版;提供商类型已简化。
它无法读取旧的提供程序类型,然后数据源无法初始化。
你应该改变:
<add key="quartz.dataSource.quartzDS.provider" value="OracleClient-20 "/>
到:
<add key="quartz.dataSource.quartzDS.provider" value="OracleODP" />
并且您应该添加序列化程序类型属性,例如:
<add key="quartz.serializer.type" value="binary" />
因为您没有使用 RamJobStore。
在这里阅读:Version Migration Guide
关于c# - 无法在 Quartz.NET 中使用 AdoJobStore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20270653/