Quartz Job for Recur Appoinment Blocks Daily

I am trying to create a module that register the provider addition attributes like the Shifts : Morning or day shift or both , Time Period Of Shift and the on which days of the week or full week Now what i want is the quartz scheduler that runs the specific function on daily basis. How can i do that. I tried a quartz scheduler 1.8.9 on openmrs platform version 1.11.6 when i load the module it says Scheduler service not found and openmrs doesn’t start

Current Openmrs Version that i am running : 2.0.5

I am configuring a quartz job but getting scheduler service not found every time i load my module

https://pastebin.com/vnHVCuyE Openmrs.log

Are your changes somewhere like on github for us to take a look?

Yeah https://github.com/Siqlain/RecurAppointmentBlock @dkayiwa

Can you start by fixing this error? " BeanDefinitionParsingException: Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context. Offending resource: URL [jar:file:/C:/OpenMRS/.openmrs-lib-cache/recurappointmentblocks/lib/recurappointmentblocks-api-1.0.0-SNAPSHOT.jar!/moduleApplicationContext.xml]"

This error is because <!-- <task:annotation-driven/> --> this line is been declared twice that what this error means but i have declared it once. If i comment this line out then openmrs won’t starts and stuck in refreshing context.

Can you commit the change to ensure that the above error does not show up?

Thank you for your time i have done it. I will be pushing the latest code once i wrap it up.

This is the link for updated repository

So with this updated repository, what is the current problem?

I have been able to run the schedule job Now what i am doing is getting all the providers which threw this error. https://hastebin.com/ecepopabos.cs

But i can get the providers if i manually do this

try {


Context.authenticate( "admin" , "Admin123" );

List<Provider> providers = Context.getProviderService().getAllProviders();


finally {



(Maybe this is because the my scheduled methods are running on different threads that does not get the context from the main thread --> Guessing)

I have pushed the code and the omod file to the repo you can check

Can you point us to the class where you have the code to get providers?

This class contains the code to get all providers

This Class contains the context.getService method

From your AppointmentBlockRecurrTask. getProviders(), can you use this? Daemon.runInDaemonThread(Runnable runnable, DaemonToken token);

And here is an example in the idgen module: https://github.com/openmrs/openmrs-module-idgen/search?utf8=✓&q=daemontoken

Yeah by making module activator daemonaware. i am able to get the providers.

Now the question is how can i be able to write a cron expression if i use the idgen runnable tasks in my code. Like i want to run this function daily at 12 :00 am

Are you creating a scheduled task with an interface like this? https://demo.openmrs.org/openmrs/admin/scheduler/scheduler.form?taskId=3

No not from this interface. My module just got its own tasks which are going to be configured in the module.

Can we have a look at one such a task?