Quartz.net as a windows: how to configure quartz_jobs.xml to use Ado JobStore

1,773 views
Skip to first unread message

aleo

unread,
Apr 1, 2010, 12:43:19 PM4/1/10
to Quartz.NET
Hi,
i am using quartz in my project, and i'm storing the jobs in the
adojobstore,
i've created a working quartz windows service, but i can't find where
i can configure the quartz_jobs.xml to use AdoJobstore instead of
RamJobStore.
Thanks
Amine

i5riza

unread,
Apr 2, 2010, 2:44:17 AM4/2/10
to Quartz.NET
Aleo,

One of constructors in StdSchedulerFactory accepts name value
collection. It is scheduler configuration where you can specify job
store type. The entry in dictionary is:
<item key="quartz.jobStore.type">Quartz.Impl.AdoJobStore.JobStoreTX,
Quartz</item>

You may need to specify additional properties for the store. Check
online for possible options.

I believe the scheduler you are configuring on windows service is
supposed to fire jobs. You may also need “client” scheduler
responsible for scheduling triggers for jobs. The client scheduler
could be used in web service method handler, message bus event handler
etc. If this is your case, you can look at Quartz integration example
in project NOperation@soureforge.

If you have quartz sources downloaded, you can look at example13 (src
\Quartz.Examples\example13\).

I5riza

aleo

unread,
Apr 2, 2010, 8:22:42 AM4/2/10
to Quartz.NET
thank you i5riza

well for now i'm trying to write a small programme that work as ADO
Schedulare,
i have ASP.net application where i can add jobs and configure them,
and i need a windows service to keep the scheduler working on the
server, for now i can do CRUD operations on tasks so obviously i have
managed to configure the Scheduler to use the adojobstore, but my case
is i can't make those jobs works..
so i've googled a little bit and i found a blog that shows how to
configure Quartz.net to work as Windows service (http://
jvilalta.blogspot.com/2009/03/getting-started-with-quartznet-
part-1.html) but the good guy who wrote those articles didn't wrote
how to configure this Quartz Service to use the adojobstore.

now i'm just trying to make a small programme to make my scheduled
jobs (stored in database) fires, because if i can make it work i can
fixed as a service later, so please have a look at ADOJobStore
properties:

class Program
{
static log4net.ILog Log = null;
static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
log4net.ILog Log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

NameValueCollection properties = new
NameValueCollection();
properties["quartz.scheduler.instanceName"] =
"TaskScheduler";
properties["quartz.scheduler.instanceId"] =
"instance_one";
properties["quartz.threadPool.type"] =
"Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
// if running MS SQL Server we need this
properties["quartz.jobStore.lockHandler.type"] =
"Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.jobStore.driverDelegateType"] =
"Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.dataSource.default.connectionString"] =
"Data Source=AMINE-PC-SE7EN\\SQLEXPRESS;Initial Catalog=NameDB;User
ID=user;Password=pass";
properties["quartz.dataSource.default.provider"] =
"SqlServer-20";
properties["quartz.jobStore.type"] =
"Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.clustered"] = "true";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";

ISchedulerFactory schedFact = new
Quartz.Impl.StdSchedulerFactory(properties);
IScheduler sched = schedFact.GetScheduler();
sched.Start();
}
}


On 2 avr, 06:44, i5riza <rimas.zavis...@gmail.com> wrote:
> Aleo

i5riza

unread,
Apr 2, 2010, 8:57:57 AM4/2/10
to Quartz.NET
I guess, you need to add

properties["quartz.jobStore.type"]
="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";

Does it help?

i5riza

Jay Vilalta

unread,
Apr 2, 2010, 9:55:05 AM4/2/10
to quar...@googlegroups.com
Here are the properties I use to set up a SQL server store that loads jobs
from the quartz_jobs.xml file. They're taken from a live installation so I
think they should work for you.

# jobstore config
quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz
quartz.jobStore.dataSource = default
quartz.jobStore.tablePrefix = QRTZ_
quartz.jobStore.clustered = true
quartz.jobStore.lockHandler.type =
Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz
quartz.jobStore.driverDelegateType=Quartz.Impl.AdoJobStore.SqlServerDelegate
, Quartz

quartz.dataSource.default.connectionString = Server=db;Database=db;user
id=uid;pwd=pwd
quartz.dataSource.default.provider = SqlServer-20

# job initialization plugin handles our xml reading, without it defaults are
used -->
quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin, Quartz
quartz.plugin.xml.fileNames = ~/quartz_jobs.xml

thank you i5riza

--
You received this message because you are subscribed to the Google Groups
"Quartz.NET" group.
To post to this group, send email to quar...@googlegroups.com.
To unsubscribe from this group, send email to
quartznet+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/quartznet?hl=en.


aleo

unread,
Apr 2, 2010, 11:29:13 AM4/2/10
to Quartz.NET
i5riza,
thanks but that as you can see in my code, i have already added this
line.

Jay Vilalta,
thank you for writing "Getting Started With Quartz.Net" it helped, but
still confused i have added the lined that you have wrote, and i
started the service "Quartz Server", but i've got is bunch after the
initializings ends of exception in a loop, it's start with the
ClusterManager Exception
.....
2010-04-02 15:02:49,025 [2340] DEBUG
Quartz.Server.Service.QuartzService - Starting service
2010-04-02 15:02:49,129 [2340] ERROR
Quartz.Impl.AdoJobStore.JobStoreTX - ClusterManager: Error managing
cluster: Failed to obtain DB connection from data source 'default':
System.InvalidOperationException: Instance failure.
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, .
.......

i wonder if i have to add something or a configuration to my
quartz_job.xml.
thank you

aleo

unread,
Apr 2, 2010, 11:55:46 AM4/2/10
to Quartz.NET
i repeat
i'm tryring to configure this Quartz Windows Service to load jobs from
the database!
this database is already filled with jobs.
thank you

Jay Vilalta

unread,
Apr 2, 2010, 2:33:39 PM4/2/10
to quar...@googlegroups.com
Is your DB connection string correct? I'm talking about this property:
quartz.dataSource.default.connectionString

Seems like the server can't connect to the database...

aleo

unread,
Apr 2, 2010, 8:15:14 PM4/2/10
to Quartz.NET
hi Jay Vilalta
well it seems that i have not been so clear in my problem,
the connection to the database is correct, all i want to do is to make
the Quartz Service run the jobs that are stored in the database,
obviously that mean i can connect to the database and add jobs and
there triggers (using a asp form)
but i need to make schedular run 24/7 in order to allow the scheduler
runs the jobs!
that's why i need the quartz service to run in the background and
execute the jobs added through my asp page.

a recap:
=> i can add jobs to the database
=> i can manage them
=> i have installed the Quartz Service as described in the "http://
> > jvilalta.blogspot.com/2009/03/getting-started-with-quartznet-
> > part-1.html%
=> this service read my jobs <caution_please>BUT</caution_please>
can't execute them,and i go in result a lot of log files of 1024 ko
each of exceptions messages. the exception said that
"IllegalArgumentException -> Job class cannot be null"
=> also i've noted that the Quartz Service have stored the sample
Payroll job in the database, this job was wrote in the quartz_job.xml.
if anything can help you to help me, just ask!
thank you so much for your help.

Amine

i5riza

unread,
Apr 3, 2010, 11:29:51 AM4/3/10
to Quartz.NET
> "IllegalArgumentException -> Job class cannot be null"
Can you check if job assemblies with dependencies are located in a
folder where all assemblies of windows service are located?

From the text of exception, i think Type.GetType("job class name")
returned NULL. This might be because of missing assembly.

i5riza


On 3 Bal, 03:15, aleo <amineabdalkha...@gmail.com> wrote:

aleo

unread,
Apr 3, 2010, 12:29:41 PM4/3/10
to Quartz.NET
i5riza
no all the files seems to be there!
thanks

aleo

unread,
Apr 4, 2010, 11:30:49 AM4/4/10
to Quartz.NET
Eureka!
as i am new to the .net environment and quartz (my first real
project), i thought that the data of the class who implements IJob
Interface are stored as a blob data on the database.
I've rechecked Jay's blog (precisely this article
http://jvilalta.blogspot.com/2009/05/creating-custom-job-in-quartznet.html)
and realized that i have to make a .dll library that contains my jobs,
well it may seem to be obvious for some folks, but the newbies really
endure real stress to figure out especially if you are a trainee and
have a dead line such as my case.

thanks i5riza and Jay Vilalta!

aleo

unread,
Apr 4, 2010, 1:10:04 PM4/4/10
to Quartz.NET
well well it's not working :s
i've got this exception :
----------------------------------------------------------------------------
2010-04-04 16:41:27,825 [QuartzScheduler_TaskScheduler-
NON_CLUSTERED_MisfireHandler] ERROR Quartz.Impl.AdoJobStore.JobStoreTX
- MisfireHandler: Error handling misfires: Couldn't store trigger
'test01Trigger' for 'test01' job: Unable to cast object of type
'System.Collections.Specialized.NameValueCollection' to type
'System.Collections.IDictionary'.
Quartz.JobPersistenceException: Couldn't store trigger 'test01Trigger'
for 'test01' job: Unable to cast object of type
'System.Collections.Specialized.NameValueCollection' to type
'System.Collections.IDictionary'. ---> System.InvalidCastException:
Unable to cast object of type
'System.Collections.Specialized.NameValueCollection' to type
'System.Collections.IDictionary'.
at
Quartz.Impl.AdoJobStore.StdAdoDelegate.SelectJobDetail(ConnectionAndTransactionHolder
conn, String jobName, String groupName, ITypeLoadHelper loadHelper)
at
Quartz.Impl.AdoJobStore.JobStoreSupport.StoreTrigger(ConnectionAndTransactionHolder
conn, SchedulingContext ctxt, Trigger newTrigger, JobDetail job,
Boolean replaceExisting, String state, Boolean forceState, Boolean
recovering)
--- End of inner exception stack trace ---
-----------------------------------------------------------------------------
the content of my quartz.config file:
-----------------------------------------------------------------------------
quartz.scheduler.instanceName = TaskScheduler

# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority = Normal

# jobstore config
quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz

quartz.jobStore.dataSource = myDs


quartz.jobStore.tablePrefix = QRTZ_
quartz.jobStore.clustered = true
quartz.jobStore.lockHandler.type =
Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz
quartz.jobStore.driverDelegateType=
Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz

quartz.dataSource.myDs.connectionString = Data Source=AMINE-PC-SE7EN
\SQLEXPRESS;Initial Catalog=aleo;User ID=login;Password=password
quartz.dataSource.myDs.provider = SqlServer-20

# job initialization plugin handles our xml reading, without it
defaults are used -->

#quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin,
Quartz
#quartz.plugin.xml.fileNames = ~/quartz_jobs.xml

# export this server to remoting context
quartz.scheduler.exporter.type =
Quartz.Simpl.RemotingSchedulerExporter, Quartz
quartz.scheduler.exporter.port = 555
quartz.scheduler.exporter.bindName = QuartzScheduler
quartz.scheduler.exporter.channelType = tcp
-----------------------------------------------------------------------------
so what's wrong, i've googled this issue but the solution didn't
worked for me, the jobs are added correctly to the database, but the
service scheduler won't execute them.

Regards Amine.

aleo

unread,
Apr 9, 2010, 1:55:57 PM4/9/10
to Quartz.NET
still need the help...
up

i5riza

unread,
Apr 10, 2010, 3:33:05 PM4/10/10
to Quartz.NET
This exception is related to JobData on trigger or job. I used to get
this exception some time ago. I do not remember what exactly I changed
to make it working :(

rimas

aleo

unread,
Apr 11, 2010, 10:09:05 AM4/11/10
to Quartz.NET
well can you please show me your .config content?
that may help a lot!

i5riza

unread,
Apr 12, 2010, 2:34:01 AM4/12/10
to Quartz.NET
I am not certain this exception is because of wrong configuration.

Configuration I am using is defined in windsor config, not in
application config. You can download the sample from the following
link.
https://noperation.svn.sourceforge.net/svnroot/noperation/trunk/source/Projects.Northwind.Application/Configuration

There is separate configuration part for quartz client (used to
schedule jobs) and quartz service (used to fire jobs).

Does it help?

i5riza

Ariel Piñeiro

unread,
Apr 12, 2010, 8:08:12 AM4/12/10
to quar...@googlegroups.com
Yes. You must be to use a Windors config, regards.

2010/4/12, i5riza <rimas.z...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "Quartz.NET" group.
> To post to this group, send email to quar...@googlegroups.com.
> To unsubscribe from this group, send email to
> quartznet+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/quartznet?hl=en.
>
>

--
Enviado desde mi dispositivo móvil

aleo

unread,
Apr 12, 2010, 12:03:05 PM4/12/10
to Quartz.NET
well finally it's working, i've added some quartz properties based on
i5riza's NOperation config sample.
well ariel you don't have to use windsors config, i'm a living proof
thanks again.

On 12 avr, 12:08, Ariel Piñeiro <ariel...@gmail.com> wrote:
> Yes. You must be to use a Windors config, regards.
>

> 2010/4/12, i5riza <rimas.zavis...@gmail.com>:


>
>
>
>
>
> > I am not certain this exception is because of wrong configuration.
>
> > Configuration I am using is defined in windsor config, not in
> > application config. You can download the sample from the following
> > link.

> >https://noperation.svn.sourceforge.net/svnroot/noperation/trunk/sourc...

Reply all
Reply to author
Forward
0 new messages