锁定老帖子 主题:spring quartz任务调度示例
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-04-28
最后修改:2008-11-28
package com.xzl.quartz; import org.apache.log4j.Logger; public class TJob { <beans> <bean id="job" class="com.xzl.quartz.TJob"></bean> </beans>2.对应的xml,名字JobQuartz.xml [18点的每一分,每一秒都进行doAuth()方法的触发] import org.springframework.context.ApplicationContext;
} 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-04-10
我照着你的例子复制过去,运行的时候有错啊,不知道是什么原因啊,我也是才接触quartz,可能是包不全吧,错误如下:
测试开始 2008-04-10 20:51:55,078 INFO (AbstractApplicationContext.java:290) - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@ab853b: display name [org.springframework.context.support.ClassPathXmlApplicationContext@ab853b]; startup date [Thu Apr 10 20:51:55 CST 2008]; root of context hierarchy 2008-04-10 20:51:55,125 INFO (XmlBeanDefinitionReader.java:293) - Loading XML bean definitions from class path resource [jobQuartz.xml] 2008-04-10 20:51:55,234 INFO (AbstractApplicationContext.java:302) - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@ab853b]: org.springframework.beans.factory.support.DefaultListableBeanFactory@12cc95d 2008-04-10 20:51:55,250 INFO (DefaultListableBeanFactory.java:272) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12cc95d: defining beans [job,jobtask,cron,org.springframework.scheduling.quartz.SchedulerFactoryBean]; root of factory hierarchy 2008-04-10 20:51:55,312 INFO (DefaultSingletonBeanRegistry.java:274) - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12cc95d: defining beans [job,jobtask,cron,org.springframework.scheduling.quartz.SchedulerFactoryBean]; root of factory hierarchy Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in class path resource [jobQuartz.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at org.quartz.impl.StdSchedulerFactory.initialize(StdSchedulerFactory.java:376) at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1340) at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:674) at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:574) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1143) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:431) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:281) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at com.zh.Test.Test.main(Test.java:16) |
|
返回顶楼 | |
浏览 4030 次