spring batch

Posted on 2014-01-06
Last Modified: 2014-01-12

can anybody tell what is the reason why  the skip limit is ignored.... if skip limit is set to 1 and if i have 3 bad record.... it does not stop after processing first record...........

I am trying to call the skip by executor class

but still it gives the same error.....

o    try {

o    // job execution

o    }catch (SkipLimitExceededException skipLimitExceededException) {

§  System.exit(1);

o    } catch (Exception exception) {

§  if (log.isErrorEnabled()) {

§  log.error("Error performing job" + exception.getMessage());

o    }

o    log.debug(exception);


o    }finally {

o    context.close();

o    }


o    System.exit(0);


o   }// end of

Open in new window

public boolean shouldSkip(Throwable throwable, int skipCount)
		throws SkipLimitExceededException{
		StringBuffer stringBuffer = new StringBuffer();
		if (throwable instanceof FlatFileParseException) {
			int linenumber = ((FlatFileParseException) throwable).getLineNumber();
			String input = ((FlatFileParseException) throwable).getInput();
			stringBuffer.append("Parsing exception encountered on line #" + linenumber + "; input = " + input);
		}else {
		if (getSkipLimit() <= skipCount && getSkipLimit() > 0) {
			SkipLimitExceededException skipLimitExceededException = new SkipLimitExceededException(
					skipCount, throwable);
			log.error("Skip Limit Exceeded "+skipLimit);
			log.debug("Skip Limit Exceeded", skipLimitExceededException);
			throw skipLimitExceededException;
		}catch(SkipLimitExceededException skipLimitExceededException){
		return true;

Open in new window


         <bean id="midFlatFileLineTokenizer"


                               <property name="delimiter" value="${com.met.midutiliy.delimiter:|}" />
                               <property name="names" value="${com.met.midutiliy.field.list:fromMemberID, toMemberID}" />

 <property name="strict" value="false" />

Open in new window

Question by:roy_sanu
  • 3
LVL 16

Expert Comment

ID: 39758982
Not sure. But this :

if (getSkipLimit() <= skipCount && getSkipLimit() > 0) {

Open in new window

could anyway be simply :

if (skipCount >= getSkipLimit()){

Open in new window


Author Comment

ID: 39759755

my errors are getting displayed on the console, but i do not want to display in the console. i understand that using throwable exception i am getting error in the console How i can get rid off it... or how throwable can be logged

your comments will be highly appreciable...........

Thanks in advance...........

Encountered an error executing the step
org.springframework.batch.core.step.skip.SkipLimitExceededException: Skip limit of '2' exceeded
	at com.listener.MIDSkipPolicy.shouldSkip(
	at org.springframework.batch.core.step.skip.CompositeSkipPolicy.shouldSkip(
	at org.springframework.batch.core.step.skip.ExceptionClassifierSkipPolicy.shouldSkip(
	at org.springframework.batch.core.step.item.FaultTolerantChunkProvider.shouldSkip(
	at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(
	at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(
	at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(

Open in new window


Accepted Solution

roy_sanu earned 0 total points
ID: 39762781
Removed this part of the code it is working fine

     }catch(SkipLimitExceededException skipLimitExceededException){

Open in new window


Author Closing Comment

ID: 39774460
removal of the try and catch block of  }catch(SkipLimitExceededException skipLimitExceededException){

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question