PDA

View Full Version : Unable to Configure AdoJobStore for the Example



joon
12-23-2008, 07:59 AM
Hi,

I'm trying to configure the AdoJobStore in Spring.Scheduling.Quartz.Example.2005 to persist the jobs information into the Oracle DB. Below are the configuration details I've added to the spring-objects.xml



...
<object type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz">
<property name="triggers">
<list>
<ref object="cronTrigger" />
<ref object="simpleTrigger" />
</list>
</property>
<property name="quartzProperties">
<dictionary>
<entry key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
<entry key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz"/>
<entry key="quartz.jobStore.tablePrefix" value="CHX_" />
<entry key="quartz.jobStore.dataSource" value="myDs"/>
<entry key="quartz.jobStore.myDs.connectionString" value="User Id=chx_owner;Password=password123;Data Source=dev612;Pooling=yes;Connection Lifetime=500;Max Pool Size=20;Min Pool Size=5;Connection Timeout=10000000;Decr Pool Size=2;Incr Pool Size=5;"/>
<entry key="quartz.jobStore.myDs.provider" value="OracleClient-20"/>
<entry key="quartz.jobStore.useProperties" value="true" />

</dictionary>
</property>
</object>
...


And the following is the exception I've encountered:


Spring.Objects.Factory.ObjectCreationException: Error creating object with name
'Spring.Scheduling.Quartz.SchedulerFactoryObject#0 ' defined in
'file [C:\devl\Spring.NET\build\VS.NET.2005\Spring.Schedu ling.Quartz.Example\Debug\spring-objects.xml] line 49' :
Initialization of object failed : JobStore type 'Quartz.Impl.AdoJobStore.JobStoreTX, Quartz' props could not be configured. --->
Quartz.SchedulerException: JobStore type 'Quartz.Impl.AdoJobStore.JobStoreTX, Quartz' props could not be configured. --->
Quartz.SchedulerConfigException: Could not parse property 'myDs.provider' into correct data type: No property 'MyDs.provider'
---> System.MemberAccessException: No property 'MyDs.provider'
at Quartz.Util.ObjectUtils.SetObjectProperties(Object obj, NameValueCollection props)
--- End of inner exception stack trace ---

May I know if someone there has done something similar and can share some sample configuration (AdoJobStore to oracle DB) pls?

Regards,
Joon

Mark Pollack
01-12-2009, 03:01 PM
Hi,
I'm not sure, but you should be able to set the DbProvider property on SchedulerFactoryObject instead of using the 'native' Quartz.NET way. This would be preferable, not only to simplify things (IMHO) but also will then allow your quartz.net operations to be involved in the same transaction as other ADO.NET based operations when using spring's tx mgmt.

I'll ping Marko to take a look at your question.

Cheers,
Mark

lahma
01-12-2009, 03:43 PM
Hi,

I think you have your properties named wrong there, there correct names should be:

quartz.dataSource.myDs.connectionString
and
quartz.dataSource.myDs.provider

When using Spring.NET you can use JobStoreCMT if you want to share transactions with Spring (this is not necessary if you don't need the feature) and you can also feed the DbProvider instance straight to Quartz using DbProvider property just like Mark stated.

Hope this helps,

-Marko

joon
01-16-2009, 12:23 AM
Hi Marko,

Thanks for your correction, the connection to DB has been resolved.

As I'm running the Spring.Scheduling.Quartz.Example and configure it to run with the AdoJobStore. I have actually encountered the error for the two triggers (SimpleTrigger and CronTrigger) as below.

For cronTrigger, the exception as below:


Spring.Objects.Factory.ObjectCreationException: Error creating object with name
'Spring.Scheduling.Quartz.SchedulerFactoryObject#0 ' defined in
'file [C:\Tools\OpenSrc\Spring.NET\build
\VS.NET.2005\Spring.Scheduling.Quartz.Example\Debu g\spring-objects.xml] line 59' :
Initialization of object failed : Failure occured during job recovery. --->
Quartz.SchedulerConfigException: Failure occured during job recovery. --->
Quartz.JobPersistenceException: Couldn't store trigger 'cronTrigger' for
'exampleJob' job: Unable to cast object of type
'System.Collections.Specialized.NameValueCollectio n' to type
'System.Collections.IDictionary'. --->
System.InvalidCastException: Unable to cast object of type
'System.Collections.Specialized.NameValueCollectio n' to type 'System.Collections.IDictionary'.
at
Quartz.Impl.AdoJobStore.StdAdoDelegate.SelectJobDe tail
(ConnectionAndTransactionHolder conn, String jobName,
String groupName, ITypeLoadHelper loadHelper)
at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreTrigg er
(ConnectionAndTransactionHolder conn, SchedulingContext ctxt,
Trigger newTrigger, JobDetail job, Boolean replaceExisting,
String state, Boolean forceState, Boolean recovering)
--- End of inner exception stack trace ---


For simpleTrigger, it has generated a different exception message:



Spring.Objects.Factory.ObjectCreationException:
Error creating object with name
'Spring.Scheduling.Quartz.SchedulerFactoryObject#0 ' defined in
'file [C:\Tools\OpenSrc\Spring.NET\build\VS.NET.2005
\Spring.Scheduling.Quartz.Example\Debug\spring-objects.xml] line 59' :
Initialization of object failed : Couldn't store job:
Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable:
Type 'Spring.Scheduling.Quartz.MethodInvokingJobDetailF actoryObject'
in Assembly 'Spring.Scheduling.Quartz, Version=1.2.0.20313,
Culture=neutral, PublicKeyToken=65e474d141e25e07'
is not marked as serializable. --->
Quartz.JobPersistenceException: Couldn't store job:
Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable:
Type 'Spring.Scheduling.Quartz.MethodInvokingJobDetailF actoryObject' in
Assembly 'Spring.Scheduling.Quartz, Version=1.2.0.20313,
Culture=neutral, PublicKeyToken=65e474d141e25e07'
is not marked as serializable. --->
System.Runtime.Serialization.SerializationExceptio n:
Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable:
Type 'Spring.Scheduling.Quartz.MethodInvokingJobDetailF actoryObject'
in Assembly 'Spring.Scheduling.Quartz, Version=1.2.0.20313,
Culture=neutral, PublicKeyToken=65e474d141e25e07'
is not marked as serializable.
at Quartz.Impl.AdoJobStore.StdAdoDelegate.SerializeJo bData
(JobDataMap data)
at Quartz.Impl.AdoJobStore.StdAdoDelegate.InsertJobDe tail
(ConnectionAndTransactionHolder conn, JobDetail job)
at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJob
(ConnectionAndTransactionHolder conn, SchedulingContext ctxt,
JobDetail newJob, Boolean replaceExisting)
--- End of inner exception stack trace ---



Any tips on this pls? Thanks alot.

Regards,
Joon

lahma
01-16-2009, 02:55 PM
The problem with MethodInvokingJobDetailFactoryObject is quite easy, as the API docs state:


NOTE: JobDetails created via this FactoryObject are not serializable and thus not suitable for persistent job stores. You need to implement your own Quartz Job as a thin wrapper for each case where you want a persistent job to delegate to a specific service method.The second problem needs some more investigation...

-Marko