编程语言
首页 > 编程语言> > java – Spring Batch – 异常不可跳过

java – Spring Batch – 异常不可跳过

作者:互联网

这是我的代码:

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

Log Stacktrace:

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.lang异常.如果您还希望跳过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> 

标签:java,sql,spring,batch-processing,spring-batch
来源: https://codeday.me/bug/20190708/1405772.html