【发布时间】:2014-12-12 10:22:20
【问题描述】:
谁能提供详细信息,如如何通过提供需要执行的作业名称来实现“JobNameToJobRestartRequestAdapter”类 API 以重新启动失败的作业。
我创建了 context-xml 文件
<int:channel id="job-launches" />
<int:channel id="job-restarts" />
<int:service-activator id="restartJobClassProperties" input-channel="job-restarts" output-channel="job-requests">
<bean class="org.springframework.batch.admin.integration.JobNameToJobRestartRequestAdapter">
<property name="jobLocator" ref="jobRegistry" />
<property name="jobExplorer" ref="jobExplorer" />
</bean>
</int:service-activator>
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.JobLocator">
<property name="name" value="JobNameGoesHere" />
</bean>
<bean id="jobExplorer" class="org.springframework.batch.core.explore.JobExplorer" />
在执行读取此 context.xml 文件的主类时,出现以下错误:
使用名称创建 bean 时出错
'org.springframework.integration.config.ServiceActivatorFactoryBean#0': 无法创建内部 bean 'org.springframework.batch.admin.integration.JobNameToJobRestartRequestAdapter#0' 类型 [org.springframework.batch.admin.integration.JobNameToJobRestartRequestAdapter] 同时设置bean属性'targetObject';嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 用名字创建bean 'org.springframework.batch.admin.integration.JobNameToJobRestartRequestAdapter#0' 在类路径资源中定义 [META-INF/spring/restart-job-context.xml]:无法解析对 bean 'jobRegistry' 同时设置 bean 属性 'jobLocator';嵌套的 例外是 org.springframework.beans.factory.BeanCreationException: 在类路径中定义名称为“jobRegistry”的 bean 创建错误 资源 [META-INF/spring/restart-job-context.xml]:实例化 豆失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:不能 实例化 bean 类 [org.springframework.batch.core.configuration.JobLocator]:指定 类是一个接口
我想实现定义我想重新启动的批处理作业名称的功能,并且可以根据最后执行的步骤从 jobexplorer 中提取属性。
【问题讨论】:
标签: java spring spring-batch restart