0
我是Quartz的新手,剛剛開始使用石英調度程序的項目。該項目編制,但在運行時,它拋出以下異常:嵌套異常是org.springframework.beans.TypeMismatchException:
BeanCreationException: Error creating bean with name 'galleryBulkTrigger' defined in ServletContext resource [/WEB-INF/spring/applicationContext-scheduler.xml]: Cannot resolve reference to bean 'galleryBulkJob' while setting bean property 'jobDetail'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'galleryBulkJob' defined in ServletContext resource [/WEB-INF/spring/applicationContext-scheduler.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required
type 'java.lang.Class' for property 'jobClass'; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.sgss.nove.quartz.gallery.GalleryBulkJob]:
ApplicationContext的定義豆如下:
<bean id="galleryBulkTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="galleryBulkJob"/>
<property name="cronExpression" value="#{noveExternalProperties['cronExpression.galleryBulk']}"/>
</bean>
<bean id="galleryBulkJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.sgss.nove.quartz.gallery.GalleryBulkJob"/>
<property name="jobDataAsMap">
<map>
<entry key="galleryBulkTask" value-ref="galleryBulkTask"/>
</map>
</property>
</bean>
和類GalleryBulkJob如下:
package com.sgss.nove.quartz.gallery;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
public class GalleryBulkJob extends QuartzJobBean {
private GalleryBulkTask galleryBulkTask;
public void setGalleryBulkTask(GalleryBulkTask galleryBulkTask) {
this.galleryBulkTask = galleryBulkTask;
}
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
galleryBulkTask.executeTask();
}
}
只要我知道它應該工作,唯一的dounbt是行:<property name="jobClass" value="com.sgss.nove.quartz.gallery.GalleryBulkJob"/>
其中值被看作是一個字符串,但是一個類是預期的。
如何解決這個問題?
在此先感謝。
我只是重建了這個項目,班上那兒沒有被識別出來,但是在下一個版本中,它被識別出來了,錯誤消失了,所以我猜它現在已經被修復了。 – softwareplay
有趣的是,我們有時會忘記考慮最基本的步驟......感謝評論,我會盡力永遠不要忘記任何奇怪問題的第一步:重建項目。 – Alexander