- 浏览: 109036 次
- 性别:
最新评论
-
douglas_lhs:
如果是搜索的话,是不是就要在action里面定义页面中的属性, ...
pager-taglib 的使用 -
wayer:
请问全景显示到底是怎么回事呢?
是不是先用软件做好全景图,然后 ...
PTViewer 全景显示 -
wangjian3q:
请问 为什么 我的 项目加了 urlrewrite
好像是没 ...
[转]UrlRewrite Filter -
MrLee23:
<context-param>
& ...
配置Spring 支持 Web session,request -
MrLee23:
给你代码整理下,你的看的有点别扭`
<context ...
配置Spring 支持 Web session,request
研究了一天,在官方论坛也查询了很多,就是锁定不了原因。请各位朋友帮忙看看
spring的配置如下:
其中被调度的bean
启动后就保错
不知道有没有朋友遇到过类似问题?请大家指点
环境我用的是resin2.1.16,jdk1.4.2,spring2.0.1,quartz1.6.0
或者可以直接在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
或者可以直接在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>
看了你的问题周日自己试着作了一次....
从没出过这种错.....
看来好像是你又以什么方式去调用数据库之后产生的问题
PS:你的EmailJobBean生明方式不对应该以小写开头,并用Bean标签声明...
赫赫 ,这个地方就是那个jobClass的值 就是一个类的完整名称,
我这个类没有包名,所以直接就是这么写的。
测试后,错误依旧。
@-@.
PS:感谢回帖。
spring的配置如下:
<bean id="emailJobBean" class="org.springframework.scheduling.quartz.JobDetailBean"> <property name="jobClass" value="EmailJobBean"/> </bean> <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="emailJobBean" /> <property name="startDelay" value="2000" /> <property name="repeatInterval" value="60000" /> </bean> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="simpleTrigger"/> </list> </property> </bean>
其中被调度的bean
public class EmailJobBean extends QuartzJobBean { protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException { System.out.println("Quartz !!!"); } }
启动后就保错
14:29:38,11882 ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:205)] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-00942: table or view does not exist
不知道有没有朋友遇到过类似问题?请大家指点
环境我用的是resin2.1.16,jdk1.4.2,spring2.0.1,quartz1.6.0
评论
15 楼
eyejava
2007-03-08
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
14 楼
dwangel
2006-12-18
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>
13 楼
dwangel
2006-12-18
按照错误信息显示,你使用的quartz应该是使用数据进行job的状态的维护的,但是在数据库中没有找到相应的table,从而无法正常建立scheduler 。
如果你的不需要错误重启功能,改成用内存维护就好。
另外可能是自动装配惹得祸,存在dataSource这个bean就自动用数据库的状态维持了。
如果你的不需要错误重启功能,改成用内存维护就好。
另外可能是自动装配惹得祸,存在dataSource这个bean就自动用数据库的状态维持了。
12 楼
foxty
2006-12-18
因为这个时候你的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 。就会采取内存存储的模式了。
11 楼
抛出异常的爱
2006-12-18
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!--起动Bean--> <bean id="z" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronReportTrigger"/> </list> </property> </bean> <!--实际的工作Bean--> <bean id="courseService" class="com.spring.helloworld.CourseService"></bean> <!--jobBean用于设定启动时运用的Bean与方法--> <bean id="scheduledReportJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="courseService"/> </property> <property name="targetMethod"> <value>sendCourseEnrollmentReport</value> </property> </bean> <!--定时器设定起动频率&启动时间我设的是每5秒起动一次 (0 0 0 4 * * ?每日四点起动....)--> <bean id="cronReportTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"><ref bean="scheduledReportJobDetail"/> </property> <property name="cronExpression"><value>10,15,20,25,30,35,40,45,50,55 * * * * ?</value> </property> </bean> </beans>
看了你的问题周日自己试着作了一次....
引用
14:29:38,11882 ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:205)] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-00942: table or view does not exist
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-00942: table or view does not exist
从没出过这种错.....
看来好像是你又以什么方式去调用数据库之后产生的问题
PS:你的EmailJobBean生明方式不对应该以小写开头,并用Bean标签声明...
10 楼
抛出异常的爱
2006-12-14
init method failed?是否是你的Quartz实现的接口不对?
jobDataAsMap这个接口没看到配?
有没有关系?
jobDataAsMap这个接口没看到配?
有没有关系?
9 楼
moogle
2006-12-14
现在就是我的hibernate和quartz的配置不能并存 ,
这2者之间不会有啥不兼容吧。。。
这2者之间不会有啥不兼容吧。。。
8 楼
moogle
2006-12-13
ddandyy 写道
很奇怪
<bean id="emailJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="EmailJobBean"/>
</bean>
你没定义 id=EmailJobBean 为什么这句不报错呢
<bean id="emailJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="EmailJobBean"/>
</bean>
你没定义 id=EmailJobBean 为什么这句不报错呢
赫赫 ,这个地方就是那个jobClass的值 就是一个类的完整名称,
我这个类没有包名,所以直接就是这么写的。
7 楼
moogle
2006-12-13
<br/>
<strong>binker 写道:</strong><br/>
<div class='quote_div'>
<p>可疑之处: 1你的EmailJobBean有包前缀么? 若有那应该定义成<span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"com.yourpackagename.EmailJobBean"</span><span class='tag'>/></span><span> </span></p>
<p> <span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"emailJobBean"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.scheduling.quartz.JobDetailBean"</span><span class='tag'>></span><span> </span> </p>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"EmailJobBean"</span><span class='tag'>/></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span></span>
<p>启动后就保错 <br/>
</p>
<div class='code_title'>代码</div>
<div class='code_div'>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-j'>
<li class='alt'><span><span class='number'>14</span><span>:</span><span class='number'>29</span><span>:</span><span class='number'>38</span><span>,</span><span class='number'>11882</span><span> ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:</span><span class='number'>205</span><span>)] Context initialization failed </span></span> </li>
<li class=''><span>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-</span><span class='number'>00942</span><span>: table or view does not exist </span> </li>
</ol>
</div>
</div>
<p> </p>
<p>可疑之处2:你的spring-quartz.xml 文件配置,注意到在错误堆栈的最后一行提示jdbcstore lock exception, table or view does not exist.是否其中配置了数据源信息.你可以尝试把其他所有的配置都注释掉,只保留quartz job bean的定义.然后再调试.</p>
</div></li>
</div>
<p>谢谢先</p>
<p>1.我只是做个测试,本身就没有加包。 如果在配置文件写错这些,eclipse会直接提示类不存在的,强行跑也会ClassNotFound</p>
<p>2.我将hibernate配置的文件去掉。 Quartz可正常跑,去掉quartz,hibernate可以正常加载应用<br/>
加在一起后就还是出现同样的错误。</p>
<p>下面补spring-hibernate.xml 配置<br/>
----------------------------------------------------------------------</p>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-xml'>
<li class='alt'><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.jndi.JndiObjectFactoryBean"</span><span class='tag'>></span><span> </span></span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jndiName"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"${jdbc.jndiName}"</span><span> </span><span class='tag'>/></span><span> </span> </li>
<li class='alt'><span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></span></li>
<li class=''><span> </span> </li>
<li class='alt'><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"hibernateTemplate"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.orm.hibernate3.HibernateTemplate"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </span></li>
<li class=''><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"sessionFactory"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.orm.hibernate3.LocalSessionFactoryBean"</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='attribute'>ref</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='tag'>/></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"mappingDirectoryLocations"</span><span class='tag'>></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>list</span><span class='tag'>></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>value</span><span class='tag'>></span><span>classpath:org/moo/pojo/</span><span class='tag'><span class='tag-name'>value</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>list</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><span class='tag-name'>property</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"hibernateProperties"</span><span class='tag'>></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>props</span><span class='tag'>></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>prop</span><span> </span><span class='attribute'>key</span><span>=</span><span class='attribute-value'>"hibernate.dialect"</span><span class='tag'>></span><span>${hibernate.dialect}</span><span class='tag'><span class='tag-name'>prop</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>prop</span><span> </span><span class='attribute'>key</span><span>=</span><span class='attribute-value'>"hibernate.show_sql"</span><span class='tag'>></span><span>${hibernate.show_sql}</span><span class='tag'><span class='tag-name'>prop</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>props</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><span class='tag-name'>property</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></span></li>
<li class=''><span> //下面都是类似的dao,service比较多就不一一列出来了 </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"codeService"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.moo.service.CodeService"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"codeDao"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.moo.dao.CodeDao"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </li>
</ol>
</div>
<p><br/>
另我看日志输入在出现错误前有:</p>
<div class='dp-highlighter'>
<ol class='dp-xml'>
<li class='alt'><span><span>15:43:50,23182 INFO [org.quartz.core.QuartzScheduler.(QuartzScheduler.java:209)] Quartz Scheduler v.null.null.null created. </span></span> </li>
<li class=''><span>15:43:50,23241 INFO [org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:542)] Using db table-based data access locking (synchronization). </span> </li>
<li class='alt'><span>15:43:50,23390 DEBUG [org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:106)] Lock 'TRIGGER_ACCESS' is desired by: main </span> </li>
<li class=''><span>15:43:50,24023 DEBUG [org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:88)] Lock 'TRIGGER_ACCESS' is being obtained: main </span> </li>
<li class='alt'><span>15:43:51,24291 DEBUG [org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:107)] Lock 'TRIGGER_ACCESS' was not obtained by: main </span> </li>
<li class=''><span>15:43:51,24332 DEBUG [org.quartz.utils.ExceptionHelper.supportsNestedThrowable(ExceptionHelper.java:97)] Detected JDK support for nested exceptions. </span> </li>
<li class='alt'><span>15:43:51,24427 INFO [org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:272)] Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans </span> </li>
<li class=''><span>15:43:51,24438 INFO [org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:185)] Closing Hibernate SessionFactory </span> </li>
</ol>
</div>
<p><br/>
然后才出现了最先提到的错误</p></div>
<strong>binker 写道:</strong><br/>
<div class='quote_div'>
<p>可疑之处: 1你的EmailJobBean有包前缀么? 若有那应该定义成<span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"com.yourpackagename.EmailJobBean"</span><span class='tag'>/></span><span> </span></p>
<p> <span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"emailJobBean"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.scheduling.quartz.JobDetailBean"</span><span class='tag'>></span><span> </span> </p>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"EmailJobBean"</span><span class='tag'>/></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span></span>
<p>启动后就保错 <br/>
</p>
<div class='code_title'>代码</div>
<div class='code_div'>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-j'>
<li class='alt'><span><span class='number'>14</span><span>:</span><span class='number'>29</span><span>:</span><span class='number'>38</span><span>,</span><span class='number'>11882</span><span> ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:</span><span class='number'>205</span><span>)] Context initialization failed </span></span> </li>
<li class=''><span>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-</span><span class='number'>00942</span><span>: table or view does not exist </span> </li>
</ol>
</div>
</div>
<p> </p>
<p>可疑之处2:你的spring-quartz.xml 文件配置,注意到在错误堆栈的最后一行提示jdbcstore lock exception, table or view does not exist.是否其中配置了数据源信息.你可以尝试把其他所有的配置都注释掉,只保留quartz job bean的定义.然后再调试.</p>
</div></li>
</div>
<p>谢谢先</p>
<p>1.我只是做个测试,本身就没有加包。 如果在配置文件写错这些,eclipse会直接提示类不存在的,强行跑也会ClassNotFound</p>
<p>2.我将hibernate配置的文件去掉。 Quartz可正常跑,去掉quartz,hibernate可以正常加载应用<br/>
加在一起后就还是出现同样的错误。</p>
<p>下面补spring-hibernate.xml 配置<br/>
----------------------------------------------------------------------</p>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-xml'>
<li class='alt'><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.jndi.JndiObjectFactoryBean"</span><span class='tag'>></span><span> </span></span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jndiName"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"${jdbc.jndiName}"</span><span> </span><span class='tag'>/></span><span> </span> </li>
<li class='alt'><span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></span></li>
<li class=''><span> </span> </li>
<li class='alt'><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"hibernateTemplate"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.orm.hibernate3.HibernateTemplate"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </span></li>
<li class=''><span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"sessionFactory"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.orm.hibernate3.LocalSessionFactoryBean"</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='attribute'>ref</span><span>=</span><span class='attribute-value'>"dataSource"</span><span> </span><span class='tag'>/></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"mappingDirectoryLocations"</span><span class='tag'>></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>list</span><span class='tag'>></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>value</span><span class='tag'>></span><span>classpath:org/moo/pojo/</span><span class='tag'><span class='tag-name'>value</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>list</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><span class='tag-name'>property</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"hibernateProperties"</span><span class='tag'>></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>props</span><span class='tag'>></span><span> </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>prop</span><span> </span><span class='attribute'>key</span><span>=</span><span class='attribute-value'>"hibernate.dialect"</span><span class='tag'>></span><span>${hibernate.dialect}</span><span class='tag'><span class='tag-name'>prop</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>prop</span><span> </span><span class='attribute'>key</span><span>=</span><span class='attribute-value'>"hibernate.show_sql"</span><span class='tag'>></span><span>${hibernate.show_sql}</span><span class='tag'><span class='tag-name'>prop</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span> </span><span class='tag'><span class='tag-name'>props</span><span class='tag'>></span><span> </span> </span></li>
<li class=''><span> </span><span class='tag'><span class='tag-name'>property</span><span class='tag'>></span><span> </span> </span></li>
<li class='alt'><span><span class='tag'><span class='tag-name'>bean</span><span class='tag'>></span><span> </span> </span></span></li>
<li class=''><span> //下面都是类似的dao,service比较多就不一一列出来了 </span> </li>
<li class='alt'><span> </span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"codeService"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.moo.service.CodeService"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </li>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"codeDao"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.moo.dao.CodeDao"</span><span> </span><span class='attribute'>autowire</span><span>=</span><span class='attribute-value'>"byName"</span><span class='tag'>/></span><span> </span> </li>
</ol>
</div>
<p><br/>
另我看日志输入在出现错误前有:</p>
<div class='dp-highlighter'>
<ol class='dp-xml'>
<li class='alt'><span><span>15:43:50,23182 INFO [org.quartz.core.QuartzScheduler.(QuartzScheduler.java:209)] Quartz Scheduler v.null.null.null created. </span></span> </li>
<li class=''><span>15:43:50,23241 INFO [org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:542)] Using db table-based data access locking (synchronization). </span> </li>
<li class='alt'><span>15:43:50,23390 DEBUG [org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:106)] Lock 'TRIGGER_ACCESS' is desired by: main </span> </li>
<li class=''><span>15:43:50,24023 DEBUG [org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:88)] Lock 'TRIGGER_ACCESS' is being obtained: main </span> </li>
<li class='alt'><span>15:43:51,24291 DEBUG [org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:107)] Lock 'TRIGGER_ACCESS' was not obtained by: main </span> </li>
<li class=''><span>15:43:51,24332 DEBUG [org.quartz.utils.ExceptionHelper.supportsNestedThrowable(ExceptionHelper.java:97)] Detected JDK support for nested exceptions. </span> </li>
<li class='alt'><span>15:43:51,24427 INFO [org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:272)] Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans </span> </li>
<li class=''><span>15:43:51,24438 INFO [org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:185)] Closing Hibernate SessionFactory </span> </li>
</ol>
</div>
<p><br/>
然后才出现了最先提到的错误</p></div>
6 楼
ddandyy
2006-12-13
很奇怪
<bean id="emailJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="EmailJobBean"/>
</bean>
你没定义 id=EmailJobBean 为什么这句不报错呢
<bean id="emailJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="EmailJobBean"/>
</bean>
你没定义 id=EmailJobBean 为什么这句不报错呢
5 楼
moogle
2006-12-13
...
我只给出了和quartz相关的,其他的就还有一个hibernate的配置
然后就没有了。
去掉quartz的都很正常的跑。这个quartz跑得和hibernate一点关系都没有
总共分了3个配置
spring.xml
----------------------
spring-hibernate.xml就是配置了数据源和dao,service
spring-quartz.xml就是一楼的那些内容
我只给出了和quartz相关的,其他的就还有一个hibernate的配置
然后就没有了。
去掉quartz的都很正常的跑。这个quartz跑得和hibernate一点关系都没有
总共分了3个配置
spring.xml
----------------------
<beans default-autowire="byName"> <!-- 加载全局配置文件 --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:/mail.properties</value> <value>classpath:/jdbc.properties</value> <value>classpath:/hibernate.properties</value> </list> </property> </bean> </beans>
spring-hibernate.xml就是配置了数据源和dao,service
spring-quartz.xml就是一楼的那些内容
4 楼
binker
2006-12-13
<p>可疑之处: 1你的EmailJobBean有包前缀么? 若有那应该定义成<span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"com.yourpackagename.EmailJobBean"</span><span class='tag'>/></span><span> </span></p>
<p> <span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"emailJobBean"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.scheduling.quartz.JobDetailBean"</span><span class='tag'>></span><span> </span> </p>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"EmailJobBean"</span><span class='tag'>/></span><span> </span></li>
<li class='alt'><span> </span><span class='tag'></</span><span class='tag-name'>bean</span><span class='tag'>></span><span> </span></li>
<li class='alt'><span></span></li>
<p>启动后就保错 <br/>
</p>
<div class='code_title'>代码</div>
<div class='code_div'>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-j'>
<li class='alt'><span><span class='number'>14</span><span>:</span><span class='number'>29</span><span>:</span><span class='number'>38</span><span>,</span><span class='number'>11882</span><span> ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:</span><span class='number'>205</span><span>)] Context initialization failed </span></span></li>
<li class=''><span>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-</span><span class='number'>00942</span><span>: table or view does not exist </span></li>
</ol>
</div>
</div>
<p> </p>
<p>可疑之处2:你的spring-quartz.xml 文件配置,注意到在错误堆栈的最后一行提示jdbcstore lock exception, table or view does not exist.是否其中配置了数据源信息.你可以尝试把其他所有的配置都注释掉,只保留quartz job bean的定义.然后再调试.</p></div>
<p> <span class='tag'><</span><span class='tag-name'>bean</span><span> </span><span class='attribute'>id</span><span>=</span><span class='attribute-value'>"emailJobBean"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"org.springframework.scheduling.quartz.JobDetailBean"</span><span class='tag'>></span><span> </span> </p>
<li class=''><span> </span><span class='tag'><</span><span class='tag-name'>property</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"jobClass"</span><span> </span><span class='attribute'>value</span><span>=</span><span class='attribute-value'>"EmailJobBean"</span><span class='tag'>/></span><span> </span></li>
<li class='alt'><span> </span><span class='tag'></</span><span class='tag-name'>bean</span><span class='tag'>></span><span> </span></li>
<li class='alt'><span></span></li>
<p>启动后就保错 <br/>
</p>
<div class='code_title'>代码</div>
<div class='code_div'>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-j'>
<li class='alt'><span><span class='number'>14</span><span>:</span><span class='number'>29</span><span>:</span><span class='number'>38</span><span>,</span><span class='number'>11882</span><span> ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:</span><span class='number'>205</span><span>)] Context initialization failed </span></span></li>
<li class=''><span>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/classes/spring-quartz.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: ORA-</span><span class='number'>00942</span><span>: table or view does not exist </span></li>
</ol>
</div>
</div>
<p> </p>
<p>可疑之处2:你的spring-quartz.xml 文件配置,注意到在错误堆栈的最后一行提示jdbcstore lock exception, table or view does not exist.是否其中配置了数据源信息.你可以尝试把其他所有的配置都注释掉,只保留quartz job bean的定义.然后再调试.</p></div>
3 楼
ddandyy
2006-12-13
那就是配置文件有问题
你给出来的不全吧
你给出来的不全吧
2 楼
moogle
2006-12-13
引用
public class EmailJobBean implements StatefulJob
测试后,错误依旧。
@-@.
PS:感谢回帖。
1 楼
ddandyy
2006-12-13
public class EmailJobBean implements StatefulJob
你试试
你试试
发表评论
-
Hibernate 对象查询生成的SQL的疑问[已解决]
2007-04-17 19:59 4765惟一外键关键的情况(many-to-one):我用了二个这 ... -
请问Hibernate中Criteria Query可以使用原生sql作为排序条件么?
2007-01-10 12:01 4111正常情况下是 addOrder(Order.desc(&quo ... -
配置Spring 支持 Web session,request
2006-12-11 23:13 7238费了1天劲,终于琢磨出来了。。。。 配置Spring使得支持S ... -
Hibernate 要点
2006-11-24 08:32 1680Hibernate 如果采用 ThreadLocal ... -
pager-taglib 的使用
2006-11-22 23:36 4459Pager-taglib 2.0 是一套分页标签库,可以灵 ... -
Confluence 无限制使用
2006-11-22 21:36 123一直很喜欢使用Confluence,可是它是商业软件,要收钱的 ... -
[转]UrlRewrite Filter
2006-11-22 21:17 1658一:首先在到官方站点下载最新的jar文件 http://tuc ... -
[转]Tomcat 5.0.28 连接池配置
2006-11-22 09:58 2998其实Tomcat的连接池配置并不是很难,但也花费了我一些时间。 ... -
[转]Tomcat类加载机制
2006-11-22 08:58 2032TOMCAT源码分析(启动框架 ... -
Log4j应用
2006-11-23 11:20 25071.Log4j初始化: 最简单的配置方式:将配置文件取名log ... -
JasperReport
2006-11-19 20:02 101在进行HTML,Excel, RTF格式,或者干脆直接打印到打 ... -
PTViewer 全景显示
2006-11-19 00:03 3307全景显示 http://www.fsoft.it/panora ... -
XStream使用学习
2006-11-18 17:46 6676java 代码 import java.io. ... -
全景展示 - ptviewer.jar
2006-11-17 00:04 83全景英文名为Panorama,又叫虚拟全景、全景虚拟现实等, ... -
开发和使用JSP自定义标签过程
2006-11-16 23:56 1839开发和使用JSP自定义标签过程: 1.开发标签实现类. H ... -
log4j的配置方法
2006-11-16 23:35 88平时都是使用了一个专门的servlet来初始化log4j,刚看 ... -
使用xStream进行java object<-->xml之间的转换
2006-11-16 23:28 18953官方网站:http://xstream.codehaus.or ...
相关推荐
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 配置Quartz属性 --> <property name="configLocation" value="classpath:quartz.properties"/> <!...
4. **整合Dubbo和Nacos**:Spring Cloud Alibaba的Nacos可以作为服务发现和配置中心。我们需要在YAML文件中配置Nacos的相关信息,如服务器地址、端口、命名空间等,并将Dubbo的服务注册到Nacos。 ```yaml cloud: ...
本文将深入探讨如何在Spring中配置多个Quartz定时任务,并结合`quartz.properties`文件进行详细讲解。 首先,我们需要理解Quartz的基本概念。Quartz是开源的作业调度框架,允许应用程序在特定时间执行任务。它支持...
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:quartz.properties"/> ``` 2. **Quartz 配置**: 通常会...
- 通过实现`org.springframework.scheduling.quartz.JobExecutionException`,可以捕获Job执行过程中的异常,进行统一处理。 8. **事务支持** - 如果Job需要在数据库事务中执行,可以利用Spring的事务管理功能,...
你需要创建一个实现了`org.quartz.Job`接口的类,并重写`execute(JobExecutionContext context)`方法,这是任务的实际执行逻辑。 6. **定义Trigger**:Trigger定义了Job何时被执行。Quartz提供了多种Trigger类型,...
Spring 和 Quartz 结合,可以使用 Quartz 提供的 Web 监控界面(如 `org.quartz.plugins.management.JobRunShellServlet`)或者通过 API 进行任务监控和管理。 8. **异常处理**: 在 Job 执行过程中如果出现异常...
Spring提供了`org.springframework.scheduling.quartz.JobDetailBean`来创建Job,`org.springframework.scheduling.quartz.CronTriggerBean`或`SimpleTriggerBean`来定义触发规则。在Spring配置文件中,我们可以声明...
Quartz和Spring-Quartz是两个在Java世界中广泛使用的定时任务管理框架。Quartz是一个开源的作业调度框架,允许应用程序定义和调度任务在特定时间执行。而Spring-Quartz则是Spring框架对Quartz的集成,它使得在Spring...
所需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之quartz例子,与oracle整合,不过spring中的MethodInvokingJobDetailFactoryBean方法在存数据库时序列化有bug,在本例子中,使用了修复后的MethodInvokingJobDetailFactoryBean方法,避免了因序列化而报错。
3. **定义Job**:创建实现`org.springframework.core.task.TaskExecutor`接口的类,或者直接使用`org.springframework.scheduling.quartz.JobDetailBean`,来定义具体的任务逻辑。 4. **配置Trigger**:创建一个...
3. 定义 Job 和 Trigger:创建 Quartz 作业类(Job),实现 org.quartz.Job 接口,并定义触发器(Trigger)来决定何时执行作业。 4. 注册 Job 和 Trigger:在 Spring 配置文件中,通过 `<bean>` 标签注册 Job 和 ...
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 配置 Quartz 的属性,如 JobStore 类型、线程池大小等 --> ``` 3. **定义Job和Trigger**:创建实现`org....
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 这里会填充你的触发器 --> <property name="configLocation" value="classpath:quartz.properties"/> ...
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://...
Spring 中的 Quartz 配置-Spring 定时器-java 定时器 在 Spring 框架中,Quartz 是一个非常流行的开源作业调度器,可以实现任务的定时执行。在本篇文章中,我们将讨论如何在 Spring 中配置 Quartz,以实现 Java ...
这里,`quartz.properties`是Quartz的配置文件,`jobFactory`是Spring的JobFactory,`myJob`定义了一个Job,`yourService`是你打算在Job中调用的服务,`executeTask`是服务中执行定时任务的方法,`cronTrigger`则是...
本篇文章将详细讲解两种在Spring MVC框架中实现定时任务的方法:Spring MVC自带的定时器以及Quartz与Spring的集成。 首先,我们来看看Spring MVC自带的定时任务。Spring MVC作为Spring框架的一个模块,主要处理HTTP...
10. **配置文件**:除了代码配置外,Quartz还可以通过`quartz.properties`配置文件进行设置,如数据库连接信息、线程池大小等。 在实际项目中,结合Spring和Quartz,开发者可以轻松地创建和管理复杂的时间驱动任务...