Spring3.2.0与Quartz1.8.6集成,启动报以下异常

cto-jp 发布于 2013/04/01 10:03
阅读 1K+
收藏 0
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.quartz.JobDetail' to required type 'org.quartz.JobDetail' for property 'jobDetail'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.quartz.JobDetail] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:465)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:496)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1437)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
    ... 21 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.quartz.JobDetail] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264)
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:450)
    ... 27 more


配置文件信息:

<?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.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">
    
    <bean id="dataSource1" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
        <property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:ORCL" />
        <property name="user" value="root" />
        <property name="password" value="root" />
        <property name="initialPoolSize" value="5" />
        <property name="minPoolSize" value="5" />
        <property name="maxPoolSize" value="20" />
        <property name="acquireIncrement" value="2" />
        <property name="maxIdleTime" value="3600" />
        <property name="idleConnectionTestPeriod" value="180" />
        <property name="automaticTestTable" value="C3P0TESTTABLE" />
    </bean>

    <!-- 要调用的工作类 -->
    <bean id="eventServiceImpl" class="com.tservice.vca.service.impl.EventServiceImpl"></bean>

    
    <bean id="vcaeventjobtask"
        class="com.tservice.vca.service.MethodInvokingJobDetailFactoryBean">
        <property name="concurrent" value="true" />
        <property name="shouldRecover" value="true" />
        <!-- 要调用的目标service类 -->
        <property name="targetObject" ref="eventServiceImpl" />
        <!-- 要调用的目标service类的方法 -->
        <property name="targetMethod" value="startMonitorEvent" />
    </bean>

    <!-- 定义触发时间 -->
    <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
        <property name="jobDetail">
            <ref bean="vcaeventjobtask" />
        </property>
        <!-- cron表达式 -->
        <property name="cronExpression">
            <!-- 每隔10秒执行一次 -->
            <value>0/10 * * * * ?</value>
        </property>
    </bean>

    <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
    <bean id="startQuertz" lazy-init="false" autowire="no"
        class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource1" />
        </property>
        <property name="configLocation" value="classpath:quartz.properties" />
        <property name="triggers">
            <list>
                <ref bean="doTime" />
            </list>
        </property>
    </bean>

</beans>


加载中
返回顶部
顶部