Java 无法启动spring批处理管理应用程序
我有一个spring批处理管理应用程序,在META-INF/spring/jobs/folder中有作业XML 作业初始化失败,出现以下错误 如果我将jobs文件夹更改为“bootstrap”…应用程序可以工作..但是没有注册jobs。。有没有人遇到过这样的问题 我的理解是,每项工作都有不同的应用环境。。但例外情况是,我是在“根”上下文中进行的Java 无法启动spring批处理管理应用程序,java,spring,spring-mvc,spring-batch,spring-batch-admin,Java,Spring,Spring Mvc,Spring Batch,Spring Batch Admin,我有一个spring批处理管理应用程序,在META-INF/spring/jobs/folder中有作业XML 作业初始化失败,出现以下错误 如果我将jobs文件夹更改为“bootstrap”…应用程序可以工作..但是没有注册jobs。。有没有人遇到过这样的问题 我的理解是,每项工作都有不同的应用环境。。但例外情况是,我是在“根”上下文中进行的 Caused by: org.springframework.context.ApplicationContextException: Cannot r
Caused by: org.springframework.context.ApplicationContextException: Cannot reinitialize with different application context: current one is [Root WebApplicationContext: startup date [Mon Jul 28 19:08:01 GMT+05:30 2014]; root of context hierarchy], passed-in one is [ResourceXmlApplicationContext:file:/Users/thrinath.d/abc/alliances/alliances/alliances-batch/target/alliances-batch/WEB-INF/classes/META-INF/spring/batch/jobs/alliances-campaign-retry-process.xml]
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:78)
at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 62 more
2014年7月28日下午7:08:07 org.apache.catalina.core.ApplicationContext日志
下面包含了示例作业xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!--Imports-->
<import resource="classpath*:META-INF/spring/batch/alliances-batch-context.xml"/>
<import resource="classpath*:META-INF/spring/batch/global-job-context.xml"/>
<!--Imports Ends-->
<!--Job schedule Beans-->
<task:scheduler id="alliancesCampaignRetryScheduler" pool-size="5"/>
<task:scheduled-tasks scheduler="alliancesCampaignRetryScheduler">
<task:scheduled ref="alliancesCampaignRetrySchedulingLauncher" method="launch" fixed-delay="1800000"/>
</task:scheduled-tasks>
<bean id="alliancesCampaignRetrySchedulingLauncher"
class="com.abc.alliances.batch.SynchronousSingletonJobLauncher">
<constructor-arg name="newJob" ref="alliances-campaign-retry-process" />
<constructor-arg name="newJobLauncher" ref="jobLauncher"/>
<constructor-arg name="newJobExplorer" ref="jobExplorer"/>
</bean>
<!--Job schedule Beans End-->
<!--Job Def-->
<batch:job id="alliances-campaign-retry-process" incrementer="incrementer">
<batch:step id="campaignRetryProcessor" >
<batch:tasklet ref="alliancesCampaignRetryProcessor"/>
</batch:step>
<batch:listeners>
<batch:listener ref="skipLogger"/>
</batch:listeners>
</batch:job>
<!--Job Def Ends-->
<!--Processor Defs-->
<bean id="alliancesCampaignRetryProcessor" class="com.abc.alliances.batch.processors.AlliancesPromoRetryProcessor">
<constructor-arg name="campaignManager" ref="campaignManager" />
<constructor-arg name="campaignPipelineManager" ref="campaignPipelineManager" />
<constructor-arg name="campaignRetryQueueDao" ref="campaignRetryQueueDao"/>
<constructor-arg name="maxRetryCount" value="5"/>
</bean>
<!--Processor Defs Ends-->
web.xml内容附在下面
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>shallowEtagHeaderFilter</filter-name>
<filter-class>org.springframework.web.filter.ShallowEtagHeaderFilter</filter-class>
</filter>
<filter>
<filter-name>hiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>shallowEtagHeaderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Batch Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Batch Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
上下文配置位置
classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml
org.springframework.web.context.ContextLoaderListener
浅滤器
org.springframework.web.filter.ShallowEtagHeaderFilter
hiddenHttpMethodFilter
org.springframework.web.filter.hiddenhttmpmethodfilter
浅滤器
/*
hiddenHttpMethodFilter
/*
批处理Servlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml
1.
批处理Servlet
/*
我对作业xml中包含的以下行进行了注释[通过其他文件导入],并开始工作。。有人能告诉我背后的解释吗
<mvc:annotation-driven/>
<context:annotation-config/>
您使用的是什么版本(Spring Batch Admin和Spring Batch)?你做了哪些配置定制?2.1.7.1.2.1.RELEASE META-INF/spring/batch/override有文件:admin-web-context.xml,web-context.xml META-INF/spring/batch有my bean context XMLS关于配置定制的内容是什么?你能更具体一点吗。。??除了管理控制台的外观之外,我没有对现有的批处理管理做太多更改。。我看到的唯一问题是..如果我在jobs文件夹中有我的job XML,spring batch会以不同的方式读取它们,上面的异常就是我得到的我正在寻找您所做的任何其他配置。这些工作看起来像什么?您还配置了什么(数据源等)?虽然每个作业都有自己的上下文是正确的,但它是父上下文的子上下文。如果我不得不猜测,您在工作中包含了一些您不需要的内容,但无法查看XML,我无法确认。