Issue
I am using spring4.0,quartz2.2.1.I get exception when I try to start my server:
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [org.quartz.Trigger] for property 'triggers[0]': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:128)
at org.springframework.beans.TypeConverterDelegate.convertToTypedArray(TypeConverterDelegate.java:441)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:198)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:458)
this is my xml
<!-- 定义调用方法 -->
<bean id="activityReportTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="activityJob"/>
</property>
<property name="targetMethod">
<value>excuteActivityJob</value>
</property>
</bean>
<!-- 定义触发器 -->
<bean id="activityReportTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="activityReportTask"/>
</property>
<property name="cronExpression">
<value>0 0/1 * * * ?</value>
</property>
</bean>
<!-- 加载定时器工厂 -->
<bean id="ziwowScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<list>
<ref bean="activityReportTrigger"/>
</list>
</list>
</property>
</bean>
it means SchedulerFactoryBean.triggers must be type of org.quartz.Trigger,but CronTriggerFactoryBean is not extend from Trigger.
anyone helps
thank you.
Solution
Change your schedulerFactoryBean definition as below.
<bean id="ziwowScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="activityReportTrigger"/>
</list>
</property>
You have added multiple list on property triggers.
Answered By - kswaughs
Answer Checked By - Mary Flores (JavaFixing Volunteer)