简体   繁体   English

Spring Batch - 异常不可跳过

[英]Spring Batch - exception is not skippable

This is my code: 这是我的代码:

<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: 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 (

I want to understand what is : "exception is not skippable" and how can I make this piece of code to work? 我想了解什么是:“异常不可跳过”,我怎样才能使这段代码工作? Currently, the step is failing leading to termination of the job. 目前,该步骤失败导致作业终止。

Spring Batch: spring-batch-2.1.xsd Spring Batch: spring-batch-2.1.xsd

The exception is a SQL exception - SQLException: 例外是SQL异常 - SQLException:

org.springframework.jdbc.UncategorizedSQLException 

Your skip rule only refers to Java.lang exceptions. 您的跳过规则仅涉及Java.lang异常。 If you want the SQL exception to be skipped as well, you must also include it in your skip rules. 如果您还希望跳过SQL异常,则还必须将其包含在跳过规则中。 Somewhere in the stack trace it will give you the exact exception which you can then include if you want records which encounter that exception to be skipped. 在堆栈跟踪的某处,它将为您提供确切的异常,如果您希望跳过遇到该异常的记录,则可以包含该异常。 It is recommended that your skip exceptions be more specific so that all your errors are not masked by skipping. 建议您的跳过异常更具体,以便跳过时不会掩盖所有错误。

<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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM