- 浏览: 1270485 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
ypzhangyx:
这要是个小白,看你的文章就得哭啊
AIX安装weblogic并部署web应用 -
cobly1837:
java encoding参考 -
lvwenwen:
very good! mark
银行业务细分,商业银行业务学习(二) -
waiting:
买过这3本书,的确有奇效!
读《火柴棒医生手记》,周尔晋奇人奇事 -
andy20008:
非NT服务修改JVM内存大小 与 NT服务修改JVM内存大小 ...
JIRA不完全手册
按spring的文档写了个最简单的quatz应用,竟然一直报错说:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in class path resource [applicationContext-rules.xml]: Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table 'cs.qrtz_locks' doesn't exist [See nested exception: java.sql.SQLException: Table 'cs.qrtz_locks' doesn't exist]]
查论坛得到如下信息:
或者可以直接在spring配置中做:
<bean name="quartzScheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTrigger" />
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.jobStore.class">
org.quartz.simpl.RAMJobStore
</prop>
</props>
</property>
</bean>
autowire真是一个万恶的家伙,出了错让你完全不知道怎么回事. 这个问题整了我一个下午,怒了.
设置org.quartz.jobStore.class为org.quartz.simpl.RAMJobStore也是没有用的.
因为
SchedulerFactoryBean的setDataSource(DataSource)方法javadoc说:
Set the default DataSource to be used by the Scheduler. If set, this will override corresponding settings in Quartz properties.
Note: If this is set, the Quartz settings should not define a job store "dataSource" to avoid meaningless double configuration.
A Spring-specific subclass of Quartz' JobStoreCMT will be used. It is therefore strongly recommended to perform all operations on the Scheduler within Spring-managed (or plain JTA) transactions. Else, database locking will not properly work and might even break (e.g. if trying to obtain a lock on Oracle without a transaction).
Supports both transactional and non-transactional DataSource access. With a non-XA DataSource and local Spring transactions, a single DataSource argument is sufficient. In case of an XA DataSource and global JTA transactions, SchedulerFactoryBean's "nonTransactionalDataSource" property should be set, passing in a non-XA DataSource that will not participate in global transactions.
See Also:
setNonTransactionalDataSource
setQuartzProperties
setTransactionManager
LocalDataSourceJobStore
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in class path resource [applicationContext-rules.xml]: Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table 'cs.qrtz_locks' doesn't exist [See nested exception: java.sql.SQLException: Table 'cs.qrtz_locks' doesn't exist]]
查论坛得到如下信息:
dwangel 写道
另外可能是自动装配惹得祸,存在dataSource这个bean就自动用数据库的状态维持了。
dwangel 写道
foxty 写道
因为这个时候你的quartz是jobstore用的HDBCJobStore模式,此时会从数据库查询任务。
你如果只是测试的话,可以在你的classpath下加一个文件quartz.properties,并且加上一句org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore 。就会采取内存存储的模式了。
你如果只是测试的话,可以在你的classpath下加一个文件quartz.properties,并且加上一句org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore 。就会采取内存存储的模式了。
或者可以直接在spring配置中做:
<bean name="quartzScheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTrigger" />
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.jobStore.class">
org.quartz.simpl.RAMJobStore
</prop>
</props>
</property>
</bean>
autowire真是一个万恶的家伙,出了错让你完全不知道怎么回事. 这个问题整了我一个下午,怒了.
设置org.quartz.jobStore.class为org.quartz.simpl.RAMJobStore也是没有用的.
因为
if (this.dataSource != null) { mergedProps.put(StdSchedulerFactory.PROP_JOB_STORE_CLASS, LocalDataSourceJobStore.class.getName()); }
SchedulerFactoryBean的setDataSource(DataSource)方法javadoc说:
Set the default DataSource to be used by the Scheduler. If set, this will override corresponding settings in Quartz properties.
Note: If this is set, the Quartz settings should not define a job store "dataSource" to avoid meaningless double configuration.
A Spring-specific subclass of Quartz' JobStoreCMT will be used. It is therefore strongly recommended to perform all operations on the Scheduler within Spring-managed (or plain JTA) transactions. Else, database locking will not properly work and might even break (e.g. if trying to obtain a lock on Oracle without a transaction).
Supports both transactional and non-transactional DataSource access. With a non-XA DataSource and local Spring transactions, a single DataSource argument is sufficient. In case of an XA DataSource and global JTA transactions, SchedulerFactoryBean's "nonTransactionalDataSource" property should be set, passing in a non-XA DataSource that will not participate in global transactions.
See Also:
setNonTransactionalDataSource
setQuartzProperties
setTransactionManager
LocalDataSourceJobStore
评论
2 楼
eyejava
2007-03-24
IntrospectorCleanupListener javadoc:
这个Introspector.flushCaches()只是迫不得已的方法,而且是为gc没做好的事情做善后工作。
引用
If the JavaBeans Introspector has been used to analyze application classes, the system-level Introspector cache will hold a hard reference to those classes. Consequently, those classes and the web application class loader will not be garbage-collected on web app shutdown! This listener performs proper cleanup, to allow for garbage collection to take effect.
Unfortunately, the only way to clean up the Introspector is to flush the entire cache, as there is no way to specifically determine the application's classes referenced there. This will remove cached introspection results for all other applications in the server too.
...
Application classes hardly ever need to use the JavaBeans Introspector directly, so are normally not the cause of Introspector resource leaks. Rather, many libraries and frameworks do not clean up the Introspector: e.g. Struts and Quartz.
Unfortunately, the only way to clean up the Introspector is to flush the entire cache, as there is no way to specifically determine the application's classes referenced there. This will remove cached introspection results for all other applications in the server too.
...
Application classes hardly ever need to use the JavaBeans Introspector directly, so are normally not the cause of Introspector resource leaks. Rather, many libraries and frameworks do not clean up the Introspector: e.g. Struts and Quartz.
这个Introspector.flushCaches()只是迫不得已的方法,而且是为gc没做好的事情做善后工作。
1 楼
bitlong
2007-03-24
我有一点不明白:
public class IntrospectorCleanupListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
}
public void contextDestroyed(ServletContextEvent event) {
Introspector.flushCaches();
}
}
这个Lisnter实在WebappDestory的时候,contextDestroyed才有实现。
WebApp一直在运行,不会执行Introspector.flushCaches(); 阿
public class IntrospectorCleanupListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
}
public void contextDestroyed(ServletContextEvent event) {
Introspector.flushCaches();
}
}
这个Lisnter实在WebappDestory的时候,contextDestroyed才有实现。
WebApp一直在运行,不会执行Introspector.flushCaches(); 阿
发表评论
-
继续说代理:用apache给tomcat/weblogic设置代理
2009-08-14 14:03 6303mod_proxy 是Apache 自带的 模块使用代理技术来 ... -
mysql errorcode: 17的原因及解决
2009-04-09 16:22 3456Caused by: java.sql.SQLExceptio ... -
用foxit reader 3.0快速建立pdf书签
2009-02-12 12:33 8709foxit reader 2.3之后加入了自定义书签的功能,官 ... -
strokeit
2008-12-19 17:34 0http://www.wecycling.com/index. ... -
Cognos reportnet开启权限认证针对空报表拆分产生的exception是不同的
2008-12-17 15:50 3329未开启权限认证时,即 ... -
FT,有时候重新设定环境变量还得重启Windows机器
2008-11-25 11:46 2418一台windows 2003 server机器,安装了cogn ... -
ping Source quench received
2008-10-28 15:27 2605ping error "source requenc ... -
foxmail没法压缩邮箱的解决办法
2008-10-28 09:32 5244通过Gmail发送了几个超大的邮件,最大的一个有20万行 ... -
beyond compare3使用
2008-08-27 23:42 41721.比较文本数据差异。 文本数据指的是类似csv文件的数据、定 ... -
svn:ignore
2008-07-04 14:44 76731.已经在版本控制的目录或者文件是不能加入svn:ignore ... -
Foxmail邮件备份到Gmail
2008-05-20 17:21 6187Gmail不断增长貌似无限制的空间+强大的搜索功能 用于储存邮 ... -
spring bean继承的一个误解
2007-06-05 15:22 3020xxAction继承BaseAction,BaseAction ... -
Maven,想说爱你不容易..
2007-05-27 15:25 2175你用maven你会感觉很环保,但是网络不通的时候却又是无尽的烦 ... -
定时加载文件到数据库tips
2007-05-22 17:50 4449装载文本文件,oracle sqlldr是个好用的工具。 如 ... -
javafx,又一个applet?
2007-05-09 18:26 5357JavaOne 出来的东西,demo和文档:https://o ... -
xwork升级到1.2 反而多了些小问题
2007-04-18 19:12 25991.每调用一个action都给出几条警告: WARN [com ... -
在many-to-many的中间表中配置索引
2007-04-11 15:44 5030<set name="cards" ... -
喜新厌旧的后果
2007-04-10 15:43 2143一直用pl/sql dev 6.0好好的,但是看到最新版本都是 ... -
jboss rules3.1m终于用了一个el:mvel,性能与ognl的对比有些让人吃惊
2007-04-10 13:41 8130引用 Later I will also move templ ... -
加班被锁,郁闷...
2007-04-05 20:25 3690等待解救中...
相关推荐
Autofac.Extras.Quartz, Quartz.Net的Autofac集成 Autofac.Extras.Quartz用于 Quartz.Net的Autofac集成包。Autofac.Extras.Quartz 为每个石英作业创建嵌套的litefime作用域。 完成作业执行后释放嵌套作用域。这允许...
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 配置Quartz属性 --> <property name="configLocation" value="classpath:quartz.properties"/> <!...
Spring提供了`org.springframework.scheduling.quartz.JobDetailBean`来创建Job,`org.springframework.scheduling.quartz.CronTriggerBean`或`SimpleTriggerBean`来定义触发规则。在Spring配置文件中,我们可以声明...
Spring 提供了与 Quartz 集成的模块,使得在 Spring 应用程序中使用 Quartz 更加便捷,包括 Job 实例的管理、触发器的配置以及对 Quartz Scheduler 的控制。 在这个 "spring+quartz demo" 中,我们可以学习到如何将...
- 通过实现`org.springframework.scheduling.quartz.JobExecutionException`,可以捕获Job执行过程中的异常,进行统一处理。 8. **事务支持** - 如果Job需要在数据库事务中执行,可以利用Spring的事务管理功能,...
标题 "spring集成quartz所需文件" 指的是将 Spring 框架与 Quartz 进行整合,以利用 Quartz 的定时任务功能。这种集成使得开发者可以在 Spring 环境下方便地管理调度任务,实现灵活的定时任务逻辑。 在描述中提到 ...
例如,Spring 提供了 `org.springframework.scheduling.quartz` 包,该包包含了一些用于配置 Quartz 的工具类和Bean定义。开发者可以通过 Spring 的 XML 配置或者注解方式来定义 Quartz 作业和触发器,使得任务调度...
而Spring-Quartz则是Spring框架对Quartz的集成,它使得在Spring应用中使用Quartz变得更加方便。 Quartz的核心概念包括Job(作业)、Trigger(触发器)和Calendar(日历)。Job是实际要执行的任务,Trigger定义了Job...
所需jar如下: spring-beans-3.2.4.RELEASE.jar spring-core-3.2.4.RELEASE.jar spring-expression-3.2.4.RELEASE....quartz-all-2.1.7.jar spring-tx-3.2.4.RELEASE.jar slf4j-log4j12-1.6.1.jar slf4j-api-1.6.1.jar
在将 Spring 2 与 Quartz 整合到 Web 应用中时,主要涉及以下几个关键知识点: 1. **Spring 2 的核心概念**:Spring 2 提供了 IoC(Inversion of Control,控制反转)和 AOP(Aspect-Oriented Programming,面向切...
import org.springframework.scheduling.quartz.CronTriggerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean; @Configuration public class QuartzConfig { @Bean public ...
3. **定义Job**:创建实现`org.springframework.core.task.TaskExecutor`接口的类,或者直接使用`org.springframework.scheduling.quartz.JobDetailBean`,来定义具体的任务逻辑。 4. **配置Trigger**:创建一个...
#### 四、Spring与Quartz的集成 Spring框架提供了与Quartz无缝集成的支持,使得开发者能够在Spring环境中方便地管理和使用Quartz的功能。通过Spring的依赖注入特性,可以简化Quartz的配置过程,提高代码的可维护性...
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> ``` - **配置触发器**: ```xml <bean id="cronTrigger" class="org.springframework....
1. **Spring与Quartz的整合**:Spring 提供了对Quartz的集成支持,通过`org.springframework.scheduling.quartz`包中的类,如`SchedulerFactoryBean`和`ThreadPoolTaskExecutor`,可以轻松地将Quartz纳入Spring的...
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:quartz.properties"/> ``` 在`quartz....
quartz.jobStore.type=org.quartz.impl.jdbcjobstore.StdJDBCJobStore quartz.jobStore.dataSource=myDS quartz.dataSource.myDS.driverClass=com.mysql.jdbc.Driver quartz.dataSource.myDS.URL=jdbc:mysql://...
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:quartz.properties"/> <!-- 其他属性配置 --> ``` `...
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- Quartz properties --> <bean id="myJob" class="org.springframework.scheduling.quartz....
import org.springframework.scheduling.quartz.SchedulerFactoryBean; @Configuration public class QuartzConfig { @Autowired private SchedulerFactoryBean schedulerFactoryBean; public void init() { ...