尽管已配置Failed元素,为什么重启失败的作业会失败?

时间:2015-06-26 14:16:01

标签: spring-batch

我试图在某个步骤中作业失败时配置重启可启动性,然后在解决问题后,它应该能够在重启时从失败的步骤继续。但它没有发生。请在下面找到我的代码。我在这里失踪了什么?

<job id="OneJob" xmlns="http://www.springframework.org/schema/batch" restartable="true">
<listeners>
<listener ref="jobStatusListener" />
</listeners>

<step id="aA" next="bB">
 <tasklet>
     <chunk commit-interval="1000" reader="o_reader" writer="o_writer" />
 </tasklet>
<listeners> <listener ref="stStepListener" /> </listeners>
</step>

<step id="bB" parent="aA">
 <tasklet>
   <chunk commit-interval="1000" reader="t_reader" writer="t_writer" />
</tasklet>
<fail on="FAILED" exit-code="EARLY TERMINATION"/>  
<next on="*" to="cC"/>       
<listeners> <listener ref="stStepListener" /> </listeners>
</step>

<step id="cC">
 <tasklet>
   <chunk commit-interval="1000" reader="th_reader" writer="th_writer" />
 </tasklet>
<listeners> <listener ref="stStepListener" /> </listeners>
</step>
</job>

在第2步中失败(使用不正确的读取语法查询使测试失败)并将状态存储为

BATCH_JOB_EXECUTION.STATUS= FAILED  
BATCH_JOB_EXECUTION.EXIT_CODE=EARLY TERMINATION

解决问题后,当我使用相同的作业参数重新启动时,它失败并将状态存储为

BATCH_JOB_EXECUTION.STATUS= FAILED  
BATCH_JOB_EXECUTION.EXIT_CODE=FAILED 

我看到如下例外

org.springframework.batch.core.JobExecutionException:流程执行意外结束

at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:140)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)
at com.one.batch.oneBatchStarter.main(oneBatchStarter.java:33)

引起:org.springframework.batch.core.job.flow.FlowExecutionException:Ended flow = oneJob at state = oneJob.aA with exception

at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:174)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
... 5 more



Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct java.util.Map$Entry : java.util.Map$Entry : Cannot construct java.util.Map$Entry : java.util.Map$Entry
 ---- Debugging information ----
message             : Cannot construct java.util.Map$Entry : java.util.Map$Entry
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct java.util.Map$Entry : java.util.Map$Entry
class               : java.util.Map$Entry
required-type       : java.util.Map$Entry
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                : /map/map/entry
line number         : -1
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
version             : 1.4.7
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at com.thoughtworks.xstream.converters.collections.MapConverte

0 个答案:

没有答案