spring集成quartz报org.springframework.scheduling.quartz.CronTriggerBean异常
spring集成quartz项目做定时任务,但是启动tomcat报错:
ClassNotFoundException: org.springframework.scheduling.quartz.CronTriggerBean…………
查阅资料,得知spring和quartz存在版本不兼容的问题,如果引入的quartz依赖是1.8.6以及以前的版本,依赖类是:
org.springframework.scheduling.quartz.CronTriggerBean
在2.xx版本之后,依赖类改为了:
org.springframework.scheduling.quartz.CronTriggerFactoryBean
由于引入的版本是2.x.x版本,所以修改了依赖类:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"><!-- guxf add --><bean id="propertyConfigurer" class=" com.ccb.ipsp.tools.PropertyUtils"><property name="locations"><list><value>classpath:ftp.properties</value></list></property></bean><!-- Quartz配置 配置定时任务 定时到服务器读取txt文件 --><!-- 任务1_定时到服务器路径下下载txt文件 --><bean name="job1" class="com.ccb.ipsp.controller.merchant.FtpFile" /><bean id="jobDetail_1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><property name="targetObject"> <ref bean="job1" /> </property> <property name="targetMethod"> <value>Test</value> </property> </bean><!-- 需注意版本问题 --> <!-- 1.8.6及以前版本:org.springframework.scheduling.quartz.CronTriggerBean --> <!-- 2.x.x版本依赖类:org.springframework.scheduling.quartz.CronTriggerFactoryBean --> <bean id="cronTrigger_1" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail"> <ref bean="jobDetail_1" /> </property> <property name="cronExpression"> <value>0 */2 * * * ?</value> <!-- 16:10分进行下载 --></property> </bean> <!-- 总配置 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 添加触发器 --> <property name="triggers"> <list> <ref bean="cronTrigger_1" /></list></property> </bean></beans>
配置了简单的测试类:
package com.ccb.ipsp.controller.merchant;public class FtpFile {public static void Test(){System.out.println("===================");}
}
启动tomcat,不报版本不兼容的错,也正常输出:
spring集成quartz报org.springframework.scheduling.quartz.CronTriggerBean异常相关推荐
- class org.springframework.scheduling.quartz.CronTriggerBean
出现这个问题主要原因是因为quartz中版本太老, 解决方法 将配置文件中org.springframework.scheduling.quartz.CronTriggerBean 改为:org.sp ...
- java crontriggerbean_从Spring 3迁移到Spring 4-org.springframework.scheduling.quartz.CronTriggerBean...
我正在尝试从Spring 3.0.5迁移到Spring4.1.X. Spring 3的类名为" org.springframework.scheduling.quartz.CronTrigg ...
- org.quartz.CronTrigger cannot be cast to org.springframework.scheduling.quartz.CronTriggerBean
问题:org.quartz.CronTrigger cannot be cast to org.springframework.scheduling.quartz.CronTriggerBean 分析 ...
- ClassNotFoundException: org.springframework.scheduling.quartz.CronTriggerBean
spring4.3.6与quartz 2.2.3集成出现以下问题 [html] view plaincopy Caused by: org.springframework.beans.factory. ...
- org.springframework.scheduling.quartz.CronTriggerBean 配置
一个Quartz的CronTrigger表达式分为七项子表达式,其中每一项以空格隔开,从左到右分别是:秒,分,时,月的某天,月,星期的某天,年:其中年不是必须的,也就是说任何一个表达式最少需要六项. ...
- 配置org.springframework.scheduling.quartz.CronTriggerBean (转载)
在项目中又用到了定时器,对于定时器的应用总是模模糊糊的,今天结合网上找到的资料与自己在项目中写的简单地在此写一下,以备需要时查阅. 一个Quartz的CronTrigger表达式分为七项子表达式,其中 ...
- Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.CronTriggerBean
在ssm框架中配置quartz定时器出现: Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.qu ...
- 配置org.springframework.scheduling.quartz.CronTriggerBean
在项目中又用到了定时器,对于定时器的应用总是模模糊糊的,今天结合网上找到的资料与自己在项目中写的简单地在此写一下,以备需要时查阅. 一个Quartz的CronTrigger表达式分为七项子表达式,其中 ...
- JAVA定时器 配置org.springframework.scheduling.quartz.CronTriggerBean
在项目中又用到了定时器,对于定时器的应用总是模模糊糊的,今天结合网上找到的资料与自己在项目中写的简单地在此写一下,以备需要时查阅. 一个Quartz的CronTrigger表达式分为七项子表达式,其中 ...
最新文章
- cout 数组_C语言学习笔记(十)二维数组内存预设
- c# 实现 加减乘除
- 【强化学习入门】马尔科夫决策过程
- python nose测试框架全面介绍十---用例的跳过
- SpringMVC的数据响应-回写数据-直接回写json格式字符串(应用)
- opera9.6 的一个顽固的bug
- C++之map的前后遍历
- 棒棒糖 宏_棒棒糖图表
- server 群辉emby_群晖容器中搭建支持硬件编码的Emby Server教程及注意事项
- 哥德巴赫猜想(升级版)(洛谷-P1579)
- 个人号微信API接口
- 【转载】MINI2440 TD35 P35触摸屏不能使用? 让我们来把一线触控改四线触控
- [Azure - SLA] 在微软云中的服务级别协议SLA
- Unity3D FPS 第一人称视角移动
- wireshark选择网卡出错解决方法The capture session could not be initiated on interface ‘en0‘ (You don‘t have ...
- [todo] 如何高效工作
- PADS如何导出BOM清单
- 台式计算机如何设置屏幕亮度,怎么调整台式电脑屏幕亮度的方法,如何调整显示器...
- OSPF/2/NBRCHG:The status of the non-virtual neighbor changes.
- Spring Boot@Bean
热门文章
- python读取图像的方法总结
- dw1000信标码_DW1000PA UWB大功率无线测距模块使用说明书
- 控制Python浮点数输出位数
- BEA:出色构建 高效整合——厦门地税税收征管系统实施案例
- ubuntu玩转freenode irc
- 25年精细创新,打印让生活更美好
- php随机整数rand和mt_rand,PHP随机数函数rand()与mt_rand()的讲解
- Excel导出表格时,下拉框数据长度超过255出现的问题及解决办法
- (1)风色从零单排《C++ Primer》 一个简单的c++程序
- PyQt5 - 获取鼠标坐标并且绘制点