Boa tarde pessoal!
Estou me batendo com esse quartz há um tempinho já, lí tudo que achei na internet, mas tá difícil, por isso vim aqui solicitar vossa ajuda!
Primeiro, vou demonstrar como meu ambiente está configurado:
WEB.XML:
<servlet>
<servlet-name>QuartzInitializer</servlet-name>
<display-name>Quartz Initializer Servlet</display-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>start-scheduler-on-load</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
QUARTZ-CONFIG.XML:
<?xml version="1.0" encoding="UTF-8"?>
<quartz-config>
<!-- Create a Trigger -->
<trigger-group>
<trigger name="myTrigger" className="org.quartz.CronTrigger">
<set-property property="cronExpression"
value="0/15 * * * * *" />
</trigger>
</trigger-group>
<!-- Create a Job -->
<job-group>
<job name="myJob"
className="com.gesplan.gsolap.agendador.ExecJob" />
</job-group>
<!-- Schedule the Job/Trigger -->
<schedule job="myJob" trigger="myTrigger" />
</quartz-config>
WEB-INF\classes\olapquartz.properties
[code]#============================================================================
Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = OlapScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.instanceIdGenerator.class=org.quartz.simpl.SimpleInstanceIdGenerator
org.quartz.scheduler.dbFailureRetryInterval=15000
org.quartz.scheduler.wrapJobExecutionInUserTransaction=false
org.quartz.scheduler.jobFactory.class=org.quartz.simpl.SimpleJobFactory
#============================================================================
Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 4
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
#============================================================================
Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
#org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
##org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.dataSource = myDS
#org.quartz.jobStore.tablePrefix = QRTZ_
#org.quartz.jobStore.isClustered = false
#============================================================================
Configure Datasources
#============================================================================
#org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
#org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@polarbear:1521:dev
#org.quartz.dataSource.myDS.user = quartz
#org.quartz.dataSource.myDS.password = quartz
#org.quartz.dataSource.myDS.maxConnections = 5
#org.quartz.dataSource.myDS.driver = org.postgresql.Driver
#org.quartz.dataSource.myDS.URL = jdbc:postgresql:dev
#org.quartz.dataSource.myDS.user = jhouse
#org.quartz.dataSource.myDS.password =
#org.quartz.dataSource.myDS.maxConnections = 5
#============================================================================
Configure Plugins
#============================================================================
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
init plugin will load jobs.xml as a classpath resource i.e. /jobs.xml if not found on file system
org.quartz.plugin.jobInitializer.fileName=olapjobs.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
#============================================================================
Shutdown Hook Plugin
#============================================================================
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = true
[/code]
WEB-INF\classes\olapjobs.xml
[code] <?xml version="1.0" encoding="utf-8" ?>
- <quartz xmlns="http://www.opensymphony.com/quartz/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opensymphony.com/quartz/JobSchedulingData http://www.opensymphony.com/quartz/xml/job_scheduling_data_1_5.xsd" version="1.5">
- <job>
- <job-detail>
<name>olapJob</name>
<group>olapJobs</group>
<job-class>com.gesplan.gsolap.agendador.ExecJob</job-class>
<volatility>false</volatility>
<durability>false</durability>
<recover>false</recover>
</job-detail> - <trigger>
- <cron>
<name>olapTrigger</name>
<group>olapJobs</group>
<job-name>olapJob</job-name>
<job-group>olapJobs</job-group> - <!-- <start-time>2003-12-17 2:15:00 pm</start-time>
–> - <!-- <end-time>2013-12-17 2:15:00 pm</end-time>
–>
<cron-expression>0/15 * * * * *</cron-expression> - <!-- every 15 seconds…
–>
</cron>
</trigger>
</job>
</quartz>[/code]
om.gesplan.gsolap.agendador.ExecJob:
[code]package com.gesplan.gsolap.agendador;
import org.quartz.*;
public class ExecJob implements Job {
public ExecJob() {
}
public void execute(JobExecutionContext context)
throws JobExecutionException {
System.out.println("Teste Job Executado");
System.err.println("Teste Job Executado");
}
}[/code]
Jar’s que estão no meu lib:
quartz.jar
jgs-quartz.jar
jgs-struts.jar
O erro que ocorre é ao inicializar o Tomcat, e é o seguinte:
[JPivot] 11 Dez 2006 14:49:39,734 ERROR [Session ] org.apache.catalina.core.ApplicationContext#log: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1104)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:153)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
[JPivot] 11 Dez 2006 14:49:39,750 ERROR [Session ] org.apache.catalina.core.StandardContext#loadOnStartup: Servlet /GSOlapWeb threw load() exception
java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1104)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:153)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Alguém tem alguma dica pra mim???
Obrigado!!!