使用Spring批处理时出错

时间:2013-07-23 12:44:02

标签: spring quartz-scheduler spring-batch spring-batch-admin

我在执行Java应用程序时遇到错误:

Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: org.springframework.transaction.annotation.TransactionManagementConfigurationSelector was imported as a Configuration class but is not annotated with @Configuration nor does it declare any @Bean methods. Update the class to meet either of these requirements or do not attempt to import it.
Offending resource: class path resource [org/springframework/transaction/annotation/TransactionManagementConfigurationSelector.class]
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClassBeanDefinitionReader.java:153)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:120)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:111)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:188)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:132)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:584)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:65)
    at org.sbq.batch.mains.SchedulerRunner.<init>(SchedulerRunner.java:46)
    at org.sbq.batch.mains.SchedulerRunner.main(SchedulerRunner.java:52)

我对这种异常没有任何线索。请帮忙。

2 个答案:

答案 0 :(得分:1)

我认为你正在混合不同版本的弹簧片。尝试下载所有jar的最新版本并执行它。

SpringSource论坛中有人发布了类似的问题,在link

答案 1 :(得分:1)

是的,使用不同版本的弹簧和弹簧批量罐可能会产生'违规资源'异常