Spring批处理异常不可跳过



这是我的代码:

<chunk reader="READER" writer="WRITER"
    commit-interval="1000" skip-limit="1000">
    <skippable-exception-classes>
        <include class="java.lang.Exception"/>
    </skippable-exception-classes>
</chunk>

日志加:

org.springframework.batch.retry.ExhaustedRetryException: Retry exhausted after last attempt in recovery path, but exception is not skippable.; nested exception is org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [ MERGE INTO FHD_GTGT_GEN_TXN_X TXN USING (

我想了解什么是:"异常是不可跳过的",我怎么能使这段代码工作?当前,该步骤失败,将导致作业终止。

Spring Batch: spring-batch-2.1.xsd

此异常为SQL异常- SQLException:

org.springframework.jdbc.UncategorizedSQLException 

你的跳过规则只涉及Java。朗例外。如果希望跳过SQL异常,还必须将其包含在跳过规则中。在堆栈跟踪的某个地方,它会给你一个确切的异常,如果你想要跳过遇到该异常的记录,你可以包括这个异常。建议您的跳过异常更具体,这样您的所有错误都不会被跳过所掩盖。

<chunk reader="READER" writer="WRITER"
 commit-interval="1000" skip-limit="1000">
  <skippable-exception-classes>
     <include class="java.lang.Exception"/>
     <include class="java.sql.SQLException"/>
  </skippable-exception-classes>
</chunk> 

最新更新