嵌套的异常是org.springframework.beans.factory.BeanCreationException:在VFS资源中创建名称为'jobRepository'的bean时出错

时间:2018-08-06 12:46:22

标签: spring-batch spring-jdbc

我遇到了错误。使用<spring.version>4.3.16.RELEASE</spring.version><spring.batch.admin>1.3.1.RELEASE</spring.batch.admin>

以下依赖项供参考:

能否让我知道是什么问题?我正在使用Spring Batch Admin和Spring项目。任何quicj解决方案都值得赞赏。

<dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-admin-manager</artifactId>
            <version>${spring.batch.admin}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.batch</groupId>
                    <artifactId>spring-context-support</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-admin-resources</artifactId>
            <version>${spring.batch.admin}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.batch</groupId>
                    <artifactId>spring-context-support</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncher' defined in VFS resource ["/content/XXXXX.ear/XXXX.war/WEB-INF/lib/spring-batch-admin-manager-1.3.1.RELEASE.jar/META-INF/spring/batch/bootstrap/manager/execution-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 VFS resource ["/content/XXXX.ear/XXXXXXXX.war/WEB-INF/lib/spring-batch-admin-manager-1.3.1.RELEASE.jar/META-INF/spring/batch/bootstrap/manager/execution-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:1533)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1280)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3780)
        at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163)
        at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61)
        at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

1 个答案:

答案 0 :(得分:0)

Spring Batch Admin不再受支持,并已由Spring Cloud Data Flow取代。您看到的错误是由于Spring Batch Admin需要的Spring Framework版本比Spring Batch 4需要的版本旧。您需要将Spring Batch和Spring Framework的版本降级为受支持的版本,或者(这是我们建议的)迁移到Spring Cloud Data Flow。