Friday, January 09, 2009

Using Quartz Scheduler on WebLogic Server

I'm not a Quartz expert but I keep on getting emails with Quartz questions as one of my blog was published as a featured article at TheServerSide.com 4-5 years back. I got some questions on using Quartz on WebLogic Server recently. I modified the original example to run on WebLogic Server.


You can download this sample from here.

The Example

1. This sample uses TestEJB which is a stateless bean that has yourMethod that need to be scheduled as a job/service.


2. This method execution is scheduled as a Job from from QuartzManagerBean which is EJB 3.0 Session bean.

3. A Generic Servlet QuartzServlet uses dependency injection to invoke the QuartzManager from its init() method.

4. The QuartzServlet is automatically loaded using load-on-start mechanism. Hence as soon as the application is deployed - the job will be submitted .

How to Run the Example

1. You can download the code example from here.

2. This is designed to be deployed in the exampleServer. If you want to deploy in a different domain/server you have to make appropriate changes to common.xml


3. Start your WebLogic Server. Unlike OC4J that requires –userThreads, no special parameter or flag is required for WebLogic to run the example.


4. Set your environment variables. If you are using examplesServer, you can use %BEA_HOME%\wlserver_10.3\samples\domains\wl_server\setExamplesEnv.bat script to set environment variables required to compile and deploy the application

5. To compile and deploy, just run

ant

You will see the application to be deployed in console where WebLogic Server was started.

Jan 9, 2009 10:45:54 AM org.quartz.plugins.management.ShutdownHookPlugin initialize

INFO: Registering Quartz shutdown hook.

Jan 9, 2009 10:45:54 AM org.quartz.simpl.RAMJobStore initialize

INFO: RAMJobStore initialized.

Jan 9, 2009 10:45:54 AM org.quartz.impl.StdSchedulerFactory instantiate

INFO: Quartz scheduler 'WebLogicQuartzScheduler' initialized from default resour

ce file in Quartz package: 'quartz.properties'

Jan 9, 2009 10:45:54 AM org.quartz.impl.StdSchedulerFactory instantiate

INFO: Quartz scheduler version: 1.3.0

Jan 9, 2009 10:45:54 AM org.quartz.core.QuartzScheduler start

INFO: Scheduler WebLogicQuartzScheduler_$_one started.

Invoking EJB to schedule Job ..

0 0/5 * * * ?

Scheduling Job ..

0 0/5 * * * ?

Timer scheduled now ..

Generating report

Report Generation Completed


Hope this helps!

9 comments:

Anonymous said...

Hi! I'm from Argentina, let me apologize for my poor English.

I've read your article about migrating DAO to EJB using JPA.

Now, i want to acquire some experience in those topics, but i really don't know where to start.

I've been looking for a good book, and i found two, wich are very interesting. These are:

* PRO EJB 3 JPA, author :Keith


*Mastering EJB, author :Sriganesh,Brose,Silverman

Can you recommend me any one?

Thanks a lot!

Santiago Basulto.-

Anonymous said...

Ouch! i forgot my mail.

sanbasulto_04@hotmail.com

Thankss!!

Santiago Basulto.-

Debu Panda said...

EJB 3 In Action is the best book :)

Anonymous said...

RX Pharmacy Online. Order Generic Medication In own Pharmacy. Buy Pills Central.
[url=http://buypillscentral.com/buy-generic-viagra-online.html]Get Best Viagra, Cialis, Levitra, Tamiflu[/url]. canadian generic drugs. Cheapest pills pharmacy

Anonymous said...

Now, i want to acquire some experience in those topics, but i really don't know where to start.

Lester, the adult tricycle man said...

There are many people searching about that and now they will find enough resources from your post. These are great step by step guideline. Thank you!

Spyros Doulgeridis said...

Hi,
Thanx for sharing this info!

2 question: I have an ADF application that runs on Weblogic. I want to create a job with quartz and you examples seems ideal.

Is there a possibility to have problem because of Quartz creating its own threads in WLS?

Is there a way to combine Weblogic WorkManager and Quartz (that is quartz to utilize WorkManagers to do its job instead of creating threads)?

Thanx in advance for any help.

Unknown said...

Hi,

Can you please help in deploying/integrating Quartz with Weblogic.?

Ankur Bhargava said...

in the code which I have downloaded I didn't find setExampleEnv.bat can you please share that also to configure environment variables.