0
我正在嘗試將spring 3升級到4.2.6。下面的代碼是從common-context.xml
調用init方法失敗;嵌套異常是java.lang.NoClassDefFoundError:org/springframework/jdbc/core/simple/ParameterizedRowMapper
<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)
無法解析錯誤我收到以下錯誤 。請幫忙!
也許你需要彈簧JDBC加入到classpath –
讓使用者看到的罐子及其版本使用的是 –
我使用的兼容版本spring-batch-core和spring infrastructure.in替代使用3.0.0,我添加了兼容版本3.0.7.This解決了這個問題。感謝Luca和Karthik的幫助。 – Sweta