首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

Query 定时器报错 急求,该如何解决

2013-10-11 
Query 定时器报错急求QuartzInitializer: Quartz Scheduler failed to initialize: org.quartz.SchedulerE

Query 定时器报错 急求
QuartzInitializer: Quartz Scheduler failed to initialize: org.quartz.SchedulerException: ThreadPool class not specified. 
2013-10-8 16:25:58 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /servletservice threw load() exception
org.quartz.SchedulerException: ThreadPool class not specified. 
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:746)
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:1206)


我的代码:
web.xml

 <servlet> 
<servlet-name>QuartzInitializer</servlet-name> 
    <servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class> 
    <init-param>
    <param-name>shutdown-on-unload</param-name>
     <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>config-file</param-name>
    <param-value>quartz.properties</param-value> 
    </init-param>
<load-on-startup>2</load-on-startup>
</servlet>


quartz.properties
org.quartz.scheduler.instanceName = PushDBScheduler  
org.quartz.scheduler.instanceId = one
orgorg.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool   
org.quartz.threadPool.threadCount = 4  
org.quartz.threadPool.threadPriority = 4 
orgorg.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = quartz_job.xml  


quartz_job.xml 
<?xml version="1.0" encoding="UTF-8"?>
<quartz>
    
     
    <job>        
     
        <job-detail>        
     
            <name>ScanItemsInDB</name>        
     
            <group>Scanning</group>        
     
            <job-class>servlet.UniversalQuartz</job-class>     
     
            <job-data-map allows-transient-data="true">     
     
                 <entry>     
     
                  <key>testmode</key>     
     
                  <value>true</value>     
     
                 </entry>     
     
            </job-data-map>     
     
        </job-detail>        
     
        <trigger>        
     
            <cron>        
     
                <name>t1</name>        
     
                <group> Scanning </group>        
     
                <job-name> ScanItemsInDB </job-name>        
     
                <job-group> Scanning </job-group>        
     
                <cron-expression>0 0/5 * * * ?</cron-expression>        


     
            </cron>        
     
        </trigger>        
     
    </job>        
     
</quartz>  





quartz
[解决办法]
可以写一个listener呀,继承ServletContextListener,然后在contextInitialized方法里面start 你的任务,在web.xml里面加入你的listener配置就可以了

热点排行