调用init方法失败;嵌套异常是java.lang.NoClassDefFoundError:org / springframework / jdbc / core / simple / ParameterizedRowMapper

时间:2017-02-15 09:19:53

标签: spring spring-batch

我正在尝试将弹簧3升级到弹簧4.2.6。以下代码来自common-context.xml

<bean id="jobRepository">   class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
        p:databaseType="oracle" p:dataSource-ref="appDataSource"
        p:transactionManager-ref="transactionManager"
        p:isolationLevelForCreate="ISOLATION_DEFAULT" />
 </bean>

这是在内部使用ParameterizedRowMapper。我得到了以下内容 运行批处理作业时出错

: Error creating bean with name
'jobLauncher' defined in class path resource [common-context.xml]:
Cannot resolve reference to bean 'jobRepository' while setting bean property 'jobRepository'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'jobRepository' defined in class path resource
[common-context.xml]: Invocation of init method failed; nested
 exception is java.lang.NoClassDefFoundError:
 org/springframework/jdbc/core/simple/ParameterizedRowMapper
org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'jobLauncher' defined in class path resource
 [common-context.xml]: Cannot resolve reference to bean 'jobRepository'
 while setting bean property 'jobRepository'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'jobRepository' defined in class path resource
 [common-context.xml]: Invocation of init method failed; nested
 exception is java.lang.NoClassDefFoundError:
 org/springframework/jdbc/core/simple/ParameterizedRowMapper    at
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

无法解决错误。请帮忙!

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题并使用最新版本的Spring Batch(3.0.7.RELEASE)和最新版本的Spring Batch Admin(1.3.1.RELEASE)修复了它。

我使用的是Spring 4.2.8.RELEASE