HI, I have 3 sql loader steps in my job and I check for errors in the sql loader output logfile before I move from first sql loader step to second sql loader step. This checking is done through decision tag using a decider. The scenario is job fails at insertIntoItemMasterStep which means 3 sql loader steps are completed and the decision is "COMPLETED" after every sql loader step. When I restart the job, the job tries to execute "decision1" which is the decider after first sql load. Ideally it shouldn't bother about any of the succeeded steps and should execute only from insertIntoItemMasterStep. Why does the flow goes back to decision1? The decision1 fails because it expects some runtime value that should be passed via first sql loader step. Please find below the stacktrace and also the job config. Any help in this regard is appreciated. I tried to narrow down the problem my removing all decision tags and was able to restart the job from insertIntoItemMasterStep.
Code:2010-06-28 15:44:30,064 DEBUG BatchJobRunner - Job Name = itemMasterDailyUploadJob, Job Order Id=222, Job Context = itemMasterDailyUploadJob-context.xml starting job with job context =itemMasterDailyUploadJob-context.xml 2010-06-28 15:44:31,923 DEBUG BatchJobRestartHelper - checkRestartJob()-->START 2010-06-28 15:44:32,048 DEBUG BatchJobRestartHelper - Job Instance for Job itemMasterDailyUploadJob = JobInstance: id=535, JobParameters=[{jobOrderId=222, type=monthly}], Job=[itemMasterDailyUploadJob] 2010-06-28 15:44:32,064 DEBUG BatchJobRestartHelper - Job Execution for Job itemMasterDailyUploadJob = JobExecution: id=659, startTime=2010-06-28 15:21:58.343,endTime=2010-06-28 15:25:33.687, lastUpdated=2010-06-28 15:25:33.687, status=FAILED, exitStatus=exitCode=FAILED;exitDescription=, job=[JobInstance: id=535, Job Parameters=[{jobOrderId=222, type=monthly}], Job=[itemMasterDailyUploadJob]] 2010-06-28 15:44:32,064 INFO BatchJobRunner - Job = itemMasterDailyUploadJob failed on last instance. 2010-06-28 15:44:32,064 INFO BatchJobRunner - Restarting the Job = itemMasterDailyUploadJob, with the Execution Id = 659 2010-06-28 15:44:32,189 INFO BatchJobExecutionListener - Starting Job = itemMasterDailyUploadJob 2010-06-28 15:44:32,220 DEBUG AttributeUtils - get attribute for dbLogFile with the value of null 2010-06-28 15:44:32,220 ERROR AbstractJob - Encountered fatal error executing job org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.jav a:141) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.ja va:281) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run (SimpleJobLauncher.java:120) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut or.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(S impleJobLauncher.java:114) at org.springframework.batch.core.launch.support.SimpleJobOperator.resta rt(SimpleJobOperator.java:267) at com.sears.hs.commons.batch.core.BatchJobRunner.startJob(BatchJobRunne r.java:129) at com.sears.hs.commons.batch.core.BatchJobRunner.main(BatchJobRunner.ja va:59) Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Ended flow=itemMasterDailyUploadJob at state=itemMasterDailyUploadJob.decision1 with exception at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(Sim pleFlow.java:152) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(Simp leFlow.java:124) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.jav a:135) ... 7 more Caused by: java.lang.NullPointerException at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at com.sears.hs.aim.pss.item.job.LogfileReaderDecider.checkForErrors(Log fileReaderDecider.java:40) at com.sears.hs.aim.pss.item.job.LogfileReaderDecider.decide(LogfileRead erDecider.java:30) at org.springframework.batch.core.job.flow.support.state.DecisionState.h andle(DecisionState.java:43) at org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBea n$DelegateState.handle(SimpleFlowFactoryBean.java:141) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(Sim pleFlow.java:144) ... 9 more
Code:<batch:job id="itemMasterUploadJob" parent="simpleJob"> <batch:step id="moveLawsonFileStep" parent="taskletStep" next="movePartCatalogFileStep"> <batch:tasklet ref="fileUtilTasklet" /> </batch:step> <batch:step id="movePartCatalogFileStep" parent="taskletStep" next="moveServigisticsFileStep"> <batch:tasklet ref="fileUtilTasklet" /> </batch:step> <batch:step id="moveServigisticsFileStep" parent="taskletStep" next="sqlLoadLawsonFileStep"> <batch:tasklet ref="fileUtilTasklet" /> </batch:step> <batch:step id="sqlLoadLawsonFileStep" parent="taskletStep" next="decision1"> <batch:tasklet ref="sQLLoaderTasklet" /> </batch:step> <batch:decision decider="decider" id="decision1"> <batch:next on="FAILED" to="alertStep" /> <batch:next on="COMPLETED" to="sqlLoadPartCatalogFileStep" /> </batch:decision> <batch:step id="sqlLoadPartCatalogFileStep" parent="taskletStep" next="decision2"> <batch:tasklet ref="sQLLoaderTasklet" /> </batch:step> <batch:decision decider="decider" id="decision2"> <batch:next on="FAILED" to="alertStep"/> <batch:next on="COMPLETED" to="sqlLoadServigisticsFileStep" /> </batch:decision> <batch:step id="sqlLoadServigisticsFileStep" parent="taskletStep" next="decision3"> <batch:tasklet ref="sQLLoaderTasklet" /> </batch:step> <batch:decision decider="decider" id="decision3"> <batch:next on="FAILED" to="alertStep"/> <batch:next on="COMPLETED" to="insertIntoItemMasterStep" /> </batch:decision> <batch:step id="insertIntoItemMasterStep" parent="taskletStep"> <batch:tasklet ref="itemMasterDAO" /> </batch:step> <batch:step id="alertStep" parent="taskletStep"> <batch:tasklet ref="alertTasklet" /> </batch:step> </batch:job>


Reply With Quote