Featured Article: Using the Quartz Enterprise Scheduler in J2EE

## Discussions

### News: Featured Article: Using the Quartz Enterprise Scheduler in J2EE

1. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE (45 messages)

Debu Panda of Oracle has written about the Quartz Scheduler, which is the open source equivalent of cron for J2EE. Debu walks you through an example of scheduling a job using the Quartz API.
Quartz is an open source enterprise job scheduler from Open Symphony project. For details and downloading Quartz please look at http://www.quartzscheduler.org/quartz/. You can use Quartz to schedule jobs in your J2EE applications such as EJBs. This article will describe Quartz can be used in your J2EE applications to schedule cron like jobs. This will include how to configure Quartz in J2EE containers taking Oracle Application Server 10g Containers for J2EE (OC4J 9.0.4) as an example.
Read Debu Panda in Using Quartz Enterprise Scheduler in J2EE Applications

2. #### Printer Friendly broke[ Go to top ]

I wanted to print the article out in "Printer Friendly" format but it failed.

Thanks,
Tom
3. #### Fixed[ Go to top ]

Thanks Tom. It is fixed now.

Cheers,

Dion
4. #### EJB-based[ Go to top ]

What about us poor folk who dont' have an EJB container?
5. #### EJB-based[ Go to top ]

Quartz can be embedded in standalon app: http://www.quartzscheduler.org/quartz/features.html
6. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

A couple of things:

1) It would be helpful to show an example of how to configure Quartz to work without a custom servlet. It can be done and is probably the most likely way people will use it within a J2EE application. I recently implemented something like this, and had to figure it out for myself since the Quartz docs weren't very explicit. Basically, you
-Configure your web app to use the Quartz initializer servlet, loading on startup. For example (from web.xml):
<servlet>
<servlet-name>quartz</servlet-name>
<display-name>Quartz Initializer Servlet</display-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
</servlet>
-Add a "quartz.properties" file to your classpath, indicating how jobs will be loaded (as well as the quartz system properties). For example (from quartz.properties):
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = quartz-jobs.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
-Add an xml file configuring your jobs and triggers, using the file name specified under the "org.quartz.plugin.jobInitializer.fileName" property.
For example (from quartz-jobs.xml, in this case):
<job>
<job-detail>
<volatility>false</volatility>
<durability>false</durability>
<recover>false</recover>
</job-detail>
<trigger>
<cron>
<name>dailyTrigger</name>
<!-- every night at 2:15AM, M-F -->
<cron-expression>0 15 2 ? * MON-FRI</cron-expression>
</cron>
</trigger>
</job>
Again, I think this is the most flexible, easy to use way to implement quartz, and I'm surprised it's not documented better. In most systems I use, I don't want to hard-code something like a scheduled process that might be subject to frequent scheduling change.

2) The author mentions the "userThreads" setting for application servers to allow Quartz to use user threads. Unfortunately, I'm kind of thread-dumb, so I don't exactly know what this means or why it's important. What happens if Quartz is deployed without this setting? What implications does this setting have to other aspects of server performance (will it cause a conflict with some other setting)? I actually am in the middle of deploying an app that uses Quartz on OC4J and would like to be aware of the implications and necessity of this setting.

Thanks,

Drew
7. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

sorry, I tried to use HTML <code> tags to offset code in my examples. Ignore them.
8. #### code -> blockquote[ Go to top ]

Hi Drew -

I took the liberty of changing the code tags to blockquote tags for you.

Cheers,

Dion
9. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Drew,
Thanks for the example without having to use a Custom Servlet. I was creating this for very customers that wanted to use cron type triggers with EJBs. I tried to venture this way but could not make this work for an EJB methods. This works great for Java classes though.

Quartz uses its own thread pools and are not container managed threads and it's cannot use the thread pooling from the container. Even I had problems firing Triggers/Jobs when I disabled User Threads.

Please make sure that you do not set the max threads to very high in the quartz.properies file. According to Quartz doc:"A maximum of 5 should be fine for a typical application".

Hope this helps..

regards
Debu
10. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Debu,

Thanks for the info on EJBs. I've been using an EJB-less environment. As far as user threads are concerned, right now I only have one job running nightly. I've configured 2 threads. Should I be concerned?

Also, in the deployment environment, the server is running a full 9iAS install, not just the oc4j container. So I can't just run the oc4j jar with a user threads switch. Any ideas on how to enable that setting in the 9iAS server? Perhaps there's a console setting? Also, I'm still unclear if this setting has any impact on any other parts of the system, or if there's any situation I should be aware of that this setting might cause.

Thanks,

Drew
11. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Drew: "So I can't just run the oc4j jar with a user threads switch. Any ideas on how to enable that setting in the 9iAS server? Perhaps there's a console setting?"

>> You can set the -userThreads in the OC4J options in the Advanced Settings for your OC4J instance.

Drew: Also, I'm still unclear if this setting has any impact on any other parts of the system, or if there's any situation I should be aware of that this setting might cause.

>> this is on a per instance basis so you would not impact any other instance

-Debu
12. #### Re: Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Hi Drew, did you get it working ? I use GlassFish and I'd like to know your solution if you found one. Thanks.
13. #### Use Message-Driven Beans[ Go to top ]

A technique I've seen used with Quartz and EJB Methods was to let the Quartz jobs simply send JMS messages that trigger message-bean driven beans. Works great, even if Quartz is embedded within an application server, either using the servlet or - what we did with WebLogic - custom-written startup-classes.
14. #### Why a servlet, why not ServletContextListener?[ Go to top ]

Is there any particular reason why the "QuartzServlet" couldn't be replaced with a "QuartzServletContextListener" which performs the same tasks upon application deployment?
15. #### Why a servlet, why not ServletContextListener?[ Go to top ]

Here's the code from the Quartz servlet that sets up the scheduler:
public void init(ServletConfig cfg) throws javax.servlet.ServletException {
super.init(cfg);

log("Quartz Initializer Servlet loaded, initializing Scheduler...");

try {

StdSchedulerFactory.getDefaultScheduler().start();

} catch (Exception e) {
log("Quartz Scheduler failed to initialize: " + e.toString());
throw new ServletException(e);
}
}

public void destroy() {
try {
Scheduler sched = StdSchedulerFactory.getDefaultScheduler();

if (sched != null) sched.shutdown();
} catch (Exception e) {
log("Quartz Scheduler failed to shutdown cleanly: " + e.toString());
e.printStackTrace();
}

log("Quartz Scheduler successful shutdown.");
}
From what I can tell, there's no reason that can't be wrapped in a context listener. That's actually not a bad idea, because then your app is a little more portable. I've found that some servers handle the startup parameter on a servlet (in WEB-INF) differently. If I'm not mistaken, Tomcat treats it as a boolean, and I know that Orion and OC4J treat it as a number, to specify the order of load (I vaguely recall that the servlet spec doesn't force it one way or the other). Using a context listener avoids this issue altogether. Though of course then you'd to deal with the fact that it wouldn't run on older servlet specs.

Thanks for the tip; I may go ahead and change my app to do this. I may even contribute the results back into Quartz.
16. #### help please[ Go to top ]

Hello everyone i just did what Drew McAuliffe post sad, but i get one big anoying error, cant parsing :|
Im using the version 1.4!

my xml file with jobs and trigers are:
<quartz xmlns="http://www.quartzscheduler.org/ns/quartz"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartzscheduler.org/ns/quartz http://www.quartzscheduler.org/ns/quartz/job_scheduling_data_1_1.xsd"
version="1.1">

<job-detail>
<name>testJob1</name>
<group>testJobs</group>
<job-class>com.quatrosi.bb.sin.service.DummyService</job-class>
<volatility>false</volatility>
<durability>false</durability>
<recover>false</recover>
</job-detail>
<trigger>
<cron>
<name>testTrigger1</name>
<group>testJobs</group>
<job-name>testJob1</job-name>
<job-group>testJobs</job-group>
<cron-expression>0/15 * * ? * *</cron-expression>
</cron>
</trigger>
</job>
</quartz>

the error is:

15/Jun/2004 17:02:57 org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler 'SINScheduler' initialized from the specified file : 'C:\
\jakarta-tomcat-5.0.14\\webapps\\sin\\WEB-INF
quartz.properties'
15/Jun/2004 17:02:57 org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler version: 1.4.0
15/Jun/2004 17:02:57 org.quartz.xml.JobSchedulingDataProcessor processFile
INFO: Parsing XML file: C:\jakarta-tomcat-5.0.14\webapps\sin\WEB-INF\data\my_job
_data.xml with systemId: null validating: true validating schema: file:/C:/jakar
g_data_1_1.xsd
15/Jun/2004 17:02:57 org.quartz.plugins.xml.JobInitializationPlugin processFile
SEVERE: Error scheduling jobs: null
java.net.MalformedURLException
at java.net.URL.<init>(URL.java:571)
at java.net.URL.<init>(URL.java:434)
at java.net.URL.<init>(URL.java:383)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
urce)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(Unknown S
ource)
at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.quartz.xml.JobSchedulingDataProcessor.processFile(JobSchedulingDa
taProcessor.java:369)
at org.quartz.xml.JobSchedulingDataProcessor.processFileAndScheduleJobs(
JobSchedulingDataProcessor.java:394)
at org.quartz.plugins.xml.JobInitializationPlugin.processFile(JobInitial
izationPlugin.java:342)
at org.quartz.plugins.xml.JobInitializationPlugin.start(JobInitializatio
nPlugin.java:316)
at org.quartz.core.QuartzScheduler.startPlugins(QuartzScheduler.java:180
0)
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:367)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:149)
at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializer
Servlet.java:126)
java:1044)
7)

Can someone help me here?
Many thanks
17. #### help please[ Go to top ]

I came across the exact same error-
What does this stack indicate ?

SEVERE: Error scheduling jobs: null
java.net.MalformedURLException
at java.net.URL.<init>(URL.java:571)
at java.net.URL.<init>(URL.java:434)
at java.net.URL.<init>(URL.java:383)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
urce)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.quartz.xml.JobSchedulingDataProcessor.processFile(JobSchedulingDa
taProcessor.java:369)
at org.quartz.xml.JobSchedulingDataProcessor.processFileAndScheduleJobs(
JobSchedulingDataProcessor.java:394)

Thanks
18. #### help please[ Go to top ]

OK if quartz.properties and jobs.xml are kept in /WEB-INF/classes then quartz is able to see it. In web.xml then just define the quartz init servlet as

<servlet>
<servlet-name>quartz</servlet-name>
<display-name>Quartz Initializer Servlet</display-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
</servlet>

That should do it.
19. #### Featured Article: Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Drew,
Do you have a sample code that u implemented on OC4J.
EAR/WAR file

Regards
Mehroz
20. #### Help needed - I am getting this error while starting tomcat.[ Go to top ]

at org.quartz.ee.servlet.QuartzInitializerServlet.init(Unknown Source)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1567) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488) at org.apache.catalina.core.StandardHost.install(StandardHost.java:863) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) at org.apache.catalina.core.StandardService.start(StandardService.java:480) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) ----- Root Cause ----- org.quartz.SchedulerException: ThreadPool class not specified. at org.quartz.impl.StdSchedulerFactory.instantiate(Unknown Source) at org.quartz.impl.StdSchedulerFactory.getScheduler(Unknown Source) at org.quartz.ee.servlet.QuartzInitializerServlet.init(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256) at org.apache.commons.digester.Rule.end(Rule.java:276) at org.apache.commons.digester.Digester.endElement(Digester.java:1058) at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

2005-03-21 09:42:05 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2005-03-21 09:42:05 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2005-03-21 09:42:06 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2005-03-21 09:42:06 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2005-03-21 09:42:06 StandardContext[/dashboard]quartz: Quartz Initializer Servlet loaded, initializing Scheduler...
2005-03-21 09:42:06 StandardContext[/dashboard]quartz: configFile ------->> null
2005-03-21 09:42:06 StandardContext[/dashboard]quartz: Quartz Scheduler failed to initialize: org.quartz.SchedulerException: ThreadPool class not specified.
2005-03-21 09:42:06 StandardContext[/dashboard]Servlet /dashboard threw load() exception
at org.quartz.ee.servlet.QuartzInitializerServlet.init(Unknown Source)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1567) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488) at org.apache.catalina.core.StandardHost.install(StandardHost.java:863) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) at org.apache.catalina.core.StandardService.start(StandardService.java:480) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) ----- Root Cause ----- org.quartz.SchedulerException: ThreadPool class not specified. at org.quartz.impl.StdSchedulerFactory.instantiate(Unknown Source) at org.quartz.impl.StdSchedulerFactory.getScheduler(Unknown Source) at org.quartz.ee.servlet.QuartzInitializerServlet.init(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903) at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256) at org.apache.commons.digester.Rule.end(Rule.java:276) at org.apache.commons.digester.Digester.endElement(Digester.java:1058) at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
21. #### "quartz-jobs.xml" vs RAM or JDBCJobStore[ Go to top ]

Drew,
I have not tried your method..but sounds promising for what I have to do.
I am EXTREMELY confused after reading all the quartz documentations out there(ranging from the opensymphony tutorial, Debu's article, Bosanac's o'reilly article, JLG plugin documentation at http://demo.jgsullivan.com/struts/QuartzPlugIn.html and your input:-)..My brain hurts:) Ignorance is a bliss, ain't it?:)

In my case I have a Struts action class which implements the StatefulJob interface (why struts? Because my whacky customer wants to run the job at his whim and fancy..grrr!-where do these people come from ?? - Well not as a chron job..but just to run it at any point in time). So I did the struts action class implementing the StatefulJob interface. Two birds in one shot..same action file can be used as just a job and also as a chron job (this is what prompted me to look at the sketchy documentation of the JLG plugin mentioned above, but that confused me more..as they mention nothing about how to use the JDBCJobStore in there)

My question is this:- if I use the "quartz-jobs.xml" and set it in the quartz.properties like you(Drew) have suggested...AND if I ALSO use the JDBCJobStore, which settings take precedence...Is that the ones in the "quartz-jobs.xml" or the JDBCJobStore table..

Also what takes precedence if I use the "quartz-jobs.xml" and a RAMJobDataStore?
22. #### Using the Quartz Enterprise Scheduler in J2EE[ Go to top ]

Hi Drew McAuliffe , I am very new to Quartz.I have downloaded quartz-1.6.0.zip(latest) and quartz-1.4.3.zip.I dont know how to use it,not even a single step of installation of quartz. can u plz help me how to use quartz from the begining step by step.i tried by mapping quartz.jar to classpath. i tried by running the examples given in that Zip .. but no use of it.. now am in the beginning stage. i dnt know what to do further and to proceed any more. plz help me in time,, i am under pressure in my company.. so plz help me as soon as possible.. Cheers and Regards, siva
23. #### Quartz in WebSphere 5.0.2[ Go to top ]

Hi,

I have tried to get it running on WebSphere 5.0.2 but I get problems by looking up the EJB. I get:

[2004-04-14 09:30:00:287 CEST] 759ba2be JobRunShell I org.quartz.core.JobRunShell Job SystemStatus Trigger Job.SystemStatus Trigger threw a JobExecutionException:
[2004-04-14 09:30:00:287 CEST] 759ba2be JobRunShell I org.quartz.core.JobRunShell TRAS0014I: The following exception was logged org.quartz.JobExecutionException: javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:". [See nested exception: javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:".]
at org.quartz.jobs.ee.ejb.EJBInvokerJob.execute(EJBInvokerJob.java:137)
at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:487) * Nested Exception (Underlying Cause) --------------- javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:". at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1638) at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:997) at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:920) at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1211) at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1203) at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1257) at javax.naming.InitialContext.lookup(InitialContext.java:359) at org.quartz.jobs.ee.ejb.EJBInvokerJob.execute(EJBInvokerJob.java:135) at org.quartz.core.JobRunShell.run(JobRunShell.java:178) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:487)

Before I had a regular servlet doing the same thing but triggered by a crontab job. The EJB is there on that JNDI name.

Any idea?

BR Joacim
24. #### Quartz in WebSphere 5.0.2[ Go to top ]

I have removed the 'java:comp/env/' and just have the value from ejb-ref-name in web.xml.
Now it can find the EJB but the method I want to use have both input argument and return value. I don't need the return value but I must use the argument. Therefore I have:

JobDetail jd = new JobDetail("SystemStatus Trigger", "SystemStatus Trigger Job", EJBInvokerJob.class);
jd.getJobDataMap().put("method", "forcePollSystems");
Object[] jdArgs = {new ForcePollSystemsRequest()};
jd.getJobDataMap().put("args", jdArgs);

now I get:

java.lang.NoSuchMethodException: forcePollSystems
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getDeclaredMethod(Class.java:1196)
at org.quartz.jobs.ee.ejb.EJBInvokerJob.execute(EJBInvokerJob.java:198)
at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
44. #### Using the Quartz Enterprise Scheduler[ Go to top ]

Hi Foster Akaketwa , I am very new to Quartz.I have downloaded quartz-1.6.0.zip(latest) and quartz-1.4.3.zip.I dont know how to use it,not even a single step of installation of quartz. can u plz help me how to use quartz from the begining step by step.i tried by mapping quartz.jar to classpath. i tried by running the examples given in that Zip .. but no use of it.. now am in the beginning stage. i dnt know what to do further and to proceed any more. plz help me in time,, plz help me as soon as possible.. Cheers and Regards, siva
45. #### how to config quartz jobstoreTX using transaction[ Go to top ]

hello, i am using quartz jobscheduling using jobstoreTX, its working fine. i need small example for quartz jdbc transaction using JobstoreTX. pls any one help me. Thanks sambath