错误1:
配置文件:synchronizeDb 0 */5 * * * ?
错误:
2013-10-23 17:29:19,754] [main] DEBUG - Invoking destroy() on bean with name 'taskExecutor'
[2013-10-23 17:29:19,754] [main] INFO - Shutting down ThreadPoolExecutor 'taskExecutor' Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hourcronQuartz' defined in class path resource [springconfig/spring-quartz-jobs.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'hourjobDetail' of bean class [org.springframework.scheduling.quartz.CronTriggerBean]: Bean property 'hourjobDetail' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1303) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:413) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at com.main.Controller.main(Controller.java:19) Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'hourjobDetail' of bean class [org.springframework.scheduling.quartz.CronTriggerBean]: Bean property 'hourjobDetail' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:805) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:655) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1300) ... 15 more 原因: <property name="hourjobDetail" ref="hourjobDetail" /> 初始化org.springframework.scheduling.quartz.CronTriggerBean时需要注入参数,参数值是setter进行的,参数名也必须匹配。 此处的参数名应为jobDetail 更改如下如下:<property name="jobDetail" ref="hourjobDetail" />