Creating a repeating date-scheduled event in a tomcat-hosted webapp

Dear All,

I am a fairly newish java developer, suddenly under pressure from a boss to come up with a solution, as detailed below. Any suggestions would be appreciated immensely!

I have written a small package which generates a series of PDF reports from a MySQL database. This package will be an add-on to a larger webapp. In terms of its function, there is no need for the package to contain servlets, JSPs etc. It only has to interact with the database, the main webapp and write files to the server's hard drive.

What I need to do is automatically run this package to generate the reports on the 30th of every month (or 28th in the case of February).

I have looked at a couple of options, including 1) Windows scheduled tasks and 2) on starting tomcat, loading/executing a servlet which has a timer to trigger the report generation.

However, option 1) appears to be too inflexible in terms of execution dates, and 2) I can't get the servlet to load/execute on Tomcat startup and also haven't yet been able to find a flexible enough timer.

So, the advice I need is:

What is the best trigger-timer combination to use for this task?

Thanks in advance,

Gavin Alexander

[1231 byte] By [gavin.daa] at [2007-10-3 2:33:57]
# 1
Use the Quartz Scheduler. Jobs can be scheduled uisng a cron trigger to fire on specific days and times. If you use a jdbc job store the job can also be run if it missed it's scheduled date.Use a ServletContextListener to start the Quartz Scheduler when the tomcat server starts.
tolmanka at 2007-7-14 19:32:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Use quartz scheduler..

Visthttp://www.opensymphony.com/quartz/ ..

download quartz.zip file..

extract it

add quartz.jar and 3 more jar file fom the lib/core directory tour classpath..

follow the tutorial given on the website and u can easily imlement it..

http://www.opensymphony.com/quartz/wikidocs/Tutorial.html

Jasdeep.Singha at 2007-7-14 19:32:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thanks tolmank and Jasdeep,I have downloaded and am now exploring possibilities with Quartz. Haven't had time to try it out yet but it looks right for the job I have in mind.Thanks again!
gavin.daa at 2007-7-14 19:32:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...