Packaging the Quartz Application
Let's finish off this early chapter by briefly discussing the process of packaging an application that utilizes the Quartz framework.
Quartz Third-Party Dependencies
Starting with the 1.5 distribution, you will see a lib directory. Underneath this directory, you'll find several subdirectories:
- libcore
- liboptional
- libuild
For deployment, you absolutely need the Quartz JAR file, as well as some of the other dependent libraries. Which third-party libraries are required is somewhat dependent on whether you are running in a stand-alone environment or as part of a J2EE distribution. Typically, the Jakarta Commons libraries (commons-logging, commons-beanutils, and so on) are needed regardless. However, when deploying into an application server environment, you need to be sure not to copy JARs that are already present; if you do, you will generally get very strange results.
Table 3.1 lists the included third-party libraries and information to help you decide whether you need to include them.
Name |
Required/Notes |
Where to Find More Information |
---|---|---|
activation.jar |
Primarily used by JavaMail |
http://java.sun.com/products/javabeans/glasgow/jaf.html |
commons-beanutils.jar |
Yes |
http://jakarta.apache.org/commons/beanutils |
commons-collections.jar |
Yes |
http://jakarta.apache.org/commons/collections |
commons-dbcp-1.1.jar |
Yes, if using a database for job storage |
http://jakarta.apache.org/commons/dbcp |
commons-digester.jar |
Yes |
If you are using some of the plug-ins, you'll need it. |
commons-logging.jar |
Yes |
http://jakarta.apache.org/commons/logging/ |
commons-pool-1.1.jar |
http://jakarta.apache.org/commons/pool/ |
|
javamail.jar |
Sending e-mails |
http://java.sun.com/products/javamail/ |
jdbc2_0-stdext.jar |
Yes, if using a database for job storage |
http://java.sun.com/products/jdbc/ |
jta.jar |
Yes, if using a for job storage |
http://java.sun.com/products/jta/database |
quartz.jar |
Yes |
Core Quartz Framework |
servlet.jar |
If using a Servlet container, but it should already be present |
http://java.sun.com/products/servlet/ |
log4j.jar |
Come on, who is not using this? |
http://logging.apache.org/ |
Configuration and Properties Files
You also must include quartz.properties with your application. If you are deploying your application in an exploded format, you should place the quartz.properties file in a directory that is loaded by the classloader. (An "exploded" format is one that is not contained within a JAR, WAR, EAR, or other Java archive, but that is laid on the file system in individual files.) For example, if you have a classes directory (such as a Web application's WEB-INF/classes directory), store the quartz.properties file there. If you are deploying in one of Java's archived formats, put the properties file in the root of the archive file. This same rule applies when using the quartz_jobs.xml file.