spring batch - Skippable Exception -
i trying skip exceptions during batch run using following config:
<chunk reader="aaafilereader" writer="aaadbwriter" commit-interval="100" skip-limit="100000"> <skippable-exception-classes> <include class="java.lang.exception" /> <exclude class="org.springframework.jdbc.cannotgetjdbcconnectionexception" /> </skippable-exception-classes> </chunk> <listeners> <listener ref="aaabatchfailurelistener" /> </listeners>
and handle exception in listener. when spring batch encounters exception not being skipped , batch run ends failed state. actual exception flatfileparse exception. how skip flatfileparseexception? here log :
:18:21.257 [main] debug o.s.b.repeat.support.repeattemplate - handling fatal exception explicitly (rethrowing first of 1): org.springframework.batch.core.step.skip.nonskippablereadexception: non-skippable exception during read 15:18:21.257 [main] error o.s.batch.core.step.abstractstep - encountered error executing step org.springframework.batch.core.step.skip.nonskippablereadexception: non-skippable exception during read @ org.springframework.batch.core.step.item.faulttolerantchunkprovider.read(faulttolerantchunkprovider.java:81) ~[spring-batch-core.jar:na] @ org.springframework.batch.core.step.item.simplechunkprovider$1.doiniteration(simplechunkprovider.java:106) ~[spring-batch-core.jar:na] @ org.springframework.batch.repeat.support.repeattemplate.getnextresult(repeattemplate.java:367) ~[spring-batch-infrastructure.jar:na] @ org.springframework.batch.repeat.support.repeattemplate.executeinternal(repeattemplate.java:215) ~[spring-batch-infr caused by: org.springframework.batch.item.file.flatfileparseexception: parsing error @ line: 5, input=[0254285458908060150983101150983 ak00055002035201401081044000804ck5861 00twist,oliver at&t 20121208 ] @ org.springframework.batch.
as per spring batch documentation of exceptions not qualified skippable.
in case clear logs org.springframework.batch.item.file.flatfileparseexception
not skippable excepotion hence re throwing org.springframework.batch.core.step.skip.nonskippablereadexception
.
read more configuring skip logic section says:
for exception encountered, skippability determined nearest superclass in class hierarchy. unclassifed exception treated 'fatal'.
read more nonskippablereadexception says:
fatal exception thrown when read operation not skipped.
Spring Batch - Skippable Exception - >>>>> Download Now
ReplyDelete>>>>> Download Full
Spring Batch - Skippable Exception - >>>>> Download LINK
>>>>> Download Now
Spring Batch - Skippable Exception - >>>>> Download Full
>>>>> Download LINK uG