Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 春季批量指数重试';即使在抛出NullPointerException之后,也不能启动_Java_Spring_Spring Batch_Spring Retry - Fatal编程技术网

Java 春季批量指数重试';即使在抛出NullPointerException之后,也不能启动

Java 春季批量指数重试';即使在抛出NullPointerException之后,也不能启动,java,spring,spring-batch,spring-retry,Java,Spring,Spring Batch,Spring Retry,我有下面的spring批处理指数重试配置,但是当我故意抛出NullPointerException时,我没有看到重试启动。为什么? <bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true"> <property name="backOffPolicy">

我有下面的spring批处理指数重试配置,但是当我故意抛出
NullPointerException
时,我没有看到重试启动。为什么?

<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>
Spring批量指数重试配置:

<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>
    public class RetrySubmitJob implements Tasklet{
       @Override
        public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
   try {        
        logger.debug("--Logger in --Spring batch--- expo --- retry----");
        String orderId = (String)    chunkContext.getStepContext().getJobParameters().get(CommonConstants.ORDER_NUMBER);
        Orders order = null;
        order.getStatus(); // To throw Null pointer exception
        } catch (Exception e) {
            logger.debug(e.fillinStackTrace());
            throw e;
        }

        return RepeatStatus.FINISHED;
        }
    }
 JobParameters jobParameters = 
                          new JobParametersBuilder()
                          .addString(CommonConstants.ORDER_NUMBER, orderNmb).toJobParameters();
jobLauncher.run(expoRetryJob, jobParameters);
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: select BATCH_JOB_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)
Hibernate: INSERT into BATCH_JOB_PARAMS(JOB_INSTANCE_ID, KEY_NAME, TYPE_CD, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: select BATCH_JOB_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_JOB_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, JOB_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: SELECT COUNT(*) FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID = ?
Hibernate: UPDATE BATCH_JOB_EXECUTION set START_TIME = ?, END_TIME = ?,  STATUS = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, CREATE_TIME = ?, LAST_UPDATED = ? where JOB_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: select BATCH_STEP_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_STEP_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, STEP_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: UPDATE BATCH_STEP_EXECUTION set START_TIME = ?, END_TIME = ?, STATUS = ?, COMMIT_COUNT = ?, READ_COUNT = ?, FILTER_COUNT = ?, WRITE_COUNT = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, READ_SKIP_COUNT = ?, PROCESS_SKIP_COUNT = ?, WRITE_SKIP_COUNT = ?, ROLLBACK_COUNT = ?, LAST_UPDATED = ? where STEP_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT VERSION FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID=?
Hibernate: UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?
--Logger in --Spring batch--- expo --- retry----
java.lang.NullPointerException
    at com.XX.XX.XX.XX.RetrySubmitJob.execute(RetrySubmitJob.java:88)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:293)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114)

<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>
在我的单元测试场景中调用此批处理的类:

<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>
    public class RetrySubmitJob implements Tasklet{
       @Override
        public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
   try {        
        logger.debug("--Logger in --Spring batch--- expo --- retry----");
        String orderId = (String)    chunkContext.getStepContext().getJobParameters().get(CommonConstants.ORDER_NUMBER);
        Orders order = null;
        order.getStatus(); // To throw Null pointer exception
        } catch (Exception e) {
            logger.debug(e.fillinStackTrace());
            throw e;
        }

        return RepeatStatus.FINISHED;
        }
    }
 JobParameters jobParameters = 
                          new JobParametersBuilder()
                          .addString(CommonConstants.ORDER_NUMBER, orderNmb).toJobParameters();
jobLauncher.run(expoRetryJob, jobParameters);
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: select BATCH_JOB_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)
Hibernate: INSERT into BATCH_JOB_PARAMS(JOB_INSTANCE_ID, KEY_NAME, TYPE_CD, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: select BATCH_JOB_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_JOB_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, JOB_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: SELECT COUNT(*) FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID = ?
Hibernate: UPDATE BATCH_JOB_EXECUTION set START_TIME = ?, END_TIME = ?,  STATUS = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, CREATE_TIME = ?, LAST_UPDATED = ? where JOB_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: select BATCH_STEP_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_STEP_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, STEP_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: UPDATE BATCH_STEP_EXECUTION set START_TIME = ?, END_TIME = ?, STATUS = ?, COMMIT_COUNT = ?, READ_COUNT = ?, FILTER_COUNT = ?, WRITE_COUNT = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, READ_SKIP_COUNT = ?, PROCESS_SKIP_COUNT = ?, WRITE_SKIP_COUNT = ?, ROLLBACK_COUNT = ?, LAST_UPDATED = ? where STEP_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT VERSION FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID=?
Hibernate: UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?
--Logger in --Spring batch--- expo --- retry----
java.lang.NullPointerException
    at com.XX.XX.XX.XX.RetrySubmitJob.execute(RetrySubmitJob.java:88)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:293)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114)
相关日志:

<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>
    public class RetrySubmitJob implements Tasklet{
       @Override
        public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
   try {        
        logger.debug("--Logger in --Spring batch--- expo --- retry----");
        String orderId = (String)    chunkContext.getStepContext().getJobParameters().get(CommonConstants.ORDER_NUMBER);
        Orders order = null;
        order.getStatus(); // To throw Null pointer exception
        } catch (Exception e) {
            logger.debug(e.fillinStackTrace());
            throw e;
        }

        return RepeatStatus.FINISHED;
        }
    }
 JobParameters jobParameters = 
                          new JobParametersBuilder()
                          .addString(CommonConstants.ORDER_NUMBER, orderNmb).toJobParameters();
jobLauncher.run(expoRetryJob, jobParameters);
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?
Hibernate: select BATCH_JOB_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)
Hibernate: INSERT into BATCH_JOB_PARAMS(JOB_INSTANCE_ID, KEY_NAME, TYPE_CD, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: select BATCH_JOB_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_JOB_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, JOB_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: SELECT COUNT(*) FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID = ?
Hibernate: UPDATE BATCH_JOB_EXECUTION set START_TIME = ?, END_TIME = ?,  STATUS = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, CREATE_TIME = ?, LAST_UPDATED = ? where JOB_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_INSTANCE_ID = ? order by JOB_EXECUTION_ID desc
Hibernate: SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ? order by STEP_EXECUTION_ID
Hibernate: select BATCH_STEP_EXECUTION_SEQ.nextval from dual
Hibernate: INSERT into BATCH_STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: INSERT INTO BATCH_STEP_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, STEP_EXECUTION_ID) VALUES(?, ?, ?)
Hibernate: UPDATE BATCH_STEP_EXECUTION set START_TIME = ?, END_TIME = ?, STATUS = ?, COMMIT_COUNT = ?, READ_COUNT = ?, FILTER_COUNT = ?, WRITE_COUNT = ?, EXIT_CODE = ?, EXIT_MESSAGE = ?, VERSION = ?, READ_SKIP_COUNT = ?, PROCESS_SKIP_COUNT = ?, WRITE_SKIP_COUNT = ?, ROLLBACK_COUNT = ?, LAST_UPDATED = ? where STEP_EXECUTION_ID = ? and VERSION = ?
Hibernate: SELECT VERSION FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID=?
Hibernate: UPDATE BATCH_STEP_EXECUTION_CONTEXT SET SHORT_CONTEXT = ?, SERIALIZED_CONTEXT = ? WHERE STEP_EXECUTION_ID = ?
--Logger in --Spring batch--- expo --- retry----
java.lang.NullPointerException
    at com.XX.XX.XX.XX.RetrySubmitJob.execute(RetrySubmitJob.java:88)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:293)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114)

Spring批处理中的容错机制不适用于定制的
Tasklet
s。它仅适用于基于块的处理。使用自定义的
Tasklet
实现时,期望您实现自己的容错逻辑。

“X不工作”不是问题,而是陈述。您可以共享任何日志吗?嗨,Michael,谢谢您的提问。在尝试之后,我在第一行运行了这是调试模式,调试点位于第一行,我并没有看到控件返回重试或任何相应的操作logs@KiranHegde很好,但我应该说越具体越好。我试着做了一些编辑。@非常感谢,只保留了stepParentExponentialRetry部分
<bean id="stepParentExponentialRetry" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
    <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="10" />
            <property name="maxInterval" value="15" />
            <property name="multiplier" value="5" />
        </bean>
        </property>
</bean>

<!-- Batch Job -->     
<bean id="checkNextRetryTasklet" class="com.XX.XX.XX.RetrySubmitJob" />
    <batch:job id="expoRetryJob" job-repository="jobRepository">
        <batch:step id="expoRetryStep" parent="stepParentExponentialRetry">
            <batch:tasklet ref="checkNextRetryTasklet" transaction-manager="txManager"/>
        </batch:step>
    </batch:job>