Results 1 to 5 of 5

Thread: reg: Batch stops on II error

  1. #1
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default reg: Batch stops on II error

    I have a spring batch process with a single reader, processor and writer. In the processor, I call 2-3 tasklets that in turn throw exception if there is a business validation error. When the batch comes across the II invalid record and when the exception is thrown the second time, the batch stops and wait for the fixed delay time interval to start again. Any ideas as to why this should happen only on the II invalid record (with exception thrown). When the first time the exception is thrown in batch process, the process continues as expected by just updating the db with the error and status of that record as 8. But when it confronts the second invalid record in the batch, the batch assumes that it has reached its end for that instance and stops and waits till its triggered again.

    Am breaking my head on this. could some one throw light as to where I can check in this regard?

  2. #2

    Default

    Is it possible for you to post the actual stack trace?

    Jeff

  3. #3
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default error log

    Quote Originally Posted by visualjeff View Post
    Is it possible for you to post the actual stack trace?

    Jeff
    More pointers: I have commit-interval =1. Am right now particular not particular about the slow processing due to this commit-interval for sure.

    I throw exception in tasklets if there is an error. And if there is an ItemProcessor error, I update my databases. This happens even for the second failed record. After that, the batch stops. Reader does not go further and assumes batch is complete and stops for the next trigger.

    Here it is: I have split the error log into 2 parts here please since the forum post needs to be some characters long

    Code:
    InDAOImpl after call to update the status for the candidate_administration with id 2823 to Score_Initiation_Error (8)! 1 record was updated in the MT database!
    Applying contribution: [StepContribution: read=1, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitStatus=EXECUTING]
    Applying contribution: [StepContribution: read=1, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitStatus=EXECUTING]
    Rollback for Exception: java.lang.Exception: java.lang.Exception: 
    Rollback for Exception: java.lang.Exception: java.lang.Exception: 
    Initiating transaction rollback on application exception
    Returning JDBC Connection to DataSource
    Returning JDBC Connection to DataSource
    Initiating transaction rollback
    Initiating transaction rollback
    Rolling back resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@54e9a7c2]
    Rolling back resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@54e9a7c2]
    Handling exception: java.lang.Exception, caused by: java.lang.Exception: java.lang.Exception: 
    Handling exception: java.lang.Exception, caused by: java.lang.Exception: java.lang.Exception: 
    Handling fatal exception explicitly (rethrowing first of 1): java.lang.Exception: java.lang.Exception: 
    Handling fatal exception explicitly (rethrowing first of 1): java.lang.Exception: java.lang.Exception: 
    Encountered an error executing the step
    java.lang.Exception: java.lang.Exception: 
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:92)
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:25)
    	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy9.process(Unknown Source)
    	at org.springframework.batch.core.step.item.SimpleChunkProcessor.doProcess(SimpleChunkProcessor.java:125)
    	at org.springframework.batch.core.step.item.SimpleChunkProcessor.transform(SimpleChunkProcessor.java:276)
    	at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:187)
    	at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:74)
    	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
    	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
    	at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
    	at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    	at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    	at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    	at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    	at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
    	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
    	at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    	at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    	at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    	at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    	at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    	at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    	at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
    	at org.caltesting.di.BatchProcessInvoker.invokeBatchJob(BatchProcessInvoker.java:64)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
    	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.Exception: 
    	at org.caltesting.di.batch.jobs.XMLAndMp3GenerationHandler.execute(XMLAndMp3GenerationHandler.java:135)
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:81)
    	... 48 more

  4. #4
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default part 2 error log

    Code:
    Encountered an error executing the step. java.lang.Exception: java.lang.Exception: 
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:92)
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:25)
    	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    	at rg.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.jaoa:131 at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy9.process(Unknown Source)	at org.springframework.batch.core.step.item.SimpleChunkProcessor.doProcess(SimpleChunkProcessor.java:125)
    	at org.springframework.batch.core.step.item.SimpleChunkProcessor.transform(SimpleChunkProcessor.java:276)
    	at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:187)
    	at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:74)
    	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
    	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
    	at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
    	at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)	at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    	at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    	at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    	at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
    	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
    	at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    	at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    	at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    	at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    	at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    	at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    	at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
    	at org.caltesting.di.BatchProcessInvoker.invokeBatchJob(BatchProcessInvoker.java:64)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
    	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
    	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.Exception: 	at org.caltesting.di.batch.jobs.XMLAndMp3GenerationHandler.execute(XMLAndMp3GenerationHandler.java:135)
    	at org.caltesting.di.batch.jobs.Processor.process(Processor.java:81)
    	... 48 more
    Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    Initiating transaction commit
    Initiating transaction commit
    Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@47503458]Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@47503458]Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.update]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.update]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    Initiating transaction commit
    Initiating transaction commit
    Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@629ca1fb] 
    Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@629ca1fb]
    Step execution complete: StepExecution: id=2, version=22, name=submiCandidateResponses, status=FAILED, exitStatus=FAILED, readCount=21, filterCount=0, writeCount=20 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=20, rollbackCount=1
    
    Step execution complete: StepExecution: id=2, version=22, name=submiCandidateResponses, status=FAILED, 
    Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    
    Initiating transaction commit
    
    Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@76f1fad1]
    
    Completed state=crdsBatchJob.submiCandidateResponses with status=FAILED
    
    Handling state=crdsBatchJob.fail0
    
    Completed state=crdsBatchJob.fail0 with status=FAILED
    
    Job execution complete: JobExecution: id=0, version=3, startTime=Fri Sep 14 15:59:10 CDT 2012, endTime=Fri Sep 14 15:59:10 CDT 2012, lastUpdated=Fri Sep 14 15:59:10 CDT 2012, status=FAILED, exitStatus=exitCode=FAILED;exitDescription=, job=[JobInstance: id=0, version=0, JobParameters=[{time=1347656349528, tiid=1347656349527}], Job=[crdsBatchJob]]
    
    Creating new transaction with name [org.springframework.batch.core.repository.support.SimpleJobRepository.update]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    
    Initiating transaction commit
    
    Committing resourceless transaction on [org.springframework.batch.support.transaction.ResourcelessTransactionManager$ResourcelessTransaction@92ca580]
    
    Removing {message-handler:sftpOutboundAdapter} as a subscriber to the 'outgoingSftpChannel' channel
    
    Channel 'outgoingSftpChannel' has 0 subscriber(s).
    
    stopped sftpOutboundAdapter
    
    Removing {logging-channel-adapter:logger.adapter} as a subscriber to the 'logger' channel
    
    Channel 'logger' has 0 subscriber(s).
    
    stopped logger.adapter
    
    Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
    
    Channel 'errorChannel' has 0 subscriber(s).
    
    stopped _org.springframework.integration.errorLogger

  5. #5
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default

    I got a solution to this. Had to configure skip execution classes and that was it! It was the simple job launcher's setting where restartable is by default true and hence the job stops after 2 failures!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •