简体   繁体   中英

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:

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

The exception is a SQL exception - SQLException:

org.springframework.jdbc.UncategorizedSQLException 

Your skip rule only refers to Java.lang exceptions. If you want the SQL exception to be skipped as well, you must also include it in your skip rules. 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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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