users@glassfish.java.net

Re: JEE5 With Quartz

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Sep 2007 07:52:49 PDT

> So the servlet has to go in the web.xml of my web app though, correct?

Yes, exactly. But the fact that this servlet lives in your webapp doesn't change anything else about your webapp (I say so because your reply to bbergquist regarding faces & stuff). The servlet is entirely invisible web-wise, you just use the fact that a servlet can auto-start upon load (EJB's can't) and has a well-defined, easy distribution/deployment mechanism to get a running quartz instance in your server. Please have a look at the Javadoc for QuartzInitializerServlet, it contains a full example of the section in web.xml you'll need.

QuartzInitializerServlet initializes a Scheduler instance, and that Scheduler sits there until you feed it Jobs (what to do) and Triggers (when it must be done). Quartz comes with a number of predefined Job types, including one that will find and execute an EJB (not EJB3 compatible, unfortunately - that's why bbergquist wrote one). That's the only place where Quartz & EJB meet.

I'd strongly suggest you do some more reading on Quartz itself (Quartz is not easy), study the tutorials and cookbook recipes on the Quartz site, and perhaps get a copy of Chuck Cavaness' book on Quartz.
[Message sent by forum member 'fvu' (fvu)]

http://forums.java.net/jive/thread.jspa?messageID=235834