Announcement Announcement Module
Collapse
No announcement yet.
More Hello world issues - TaskletStep, StepExecutionListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    You need to change your command line so that the plugin is identified correctly. This is not really a Spring Batch discussion, so why don't you go and look at the documentation for the plugin?

    Comment


    • #17
      Updating job parameter after tasklet execution

      Hi

      I'm experiencing a similar problem to that of PrebenNilsson.

      I want to update my Job Parameters after the tasklet has been executed.
      The beforeStep seems to work, but the afterStep never seems to be executed.

      My tasklet looks like this:

      Code:
      	private String umalusiFileName;
      	private FtpWrapper ftpServer;
      	private String uploadedUmalusiFilePath;
      
             ...
      
      	@Override
      	public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
      		connectToServer();
      		loginToServer();
      		File uploadedUmalusiFile = downloadFileIfNotStoredLocally(); 
      		uploadedUmalusiFilePath = uploadedUmalusiFile.getAbsolutePath();
      		return RepeatStatus.FINISHED;
      	}
      	
      	@Override
      	public ExitStatus afterStep(StepExecution stepExecution) {
      		JobParameters jobParameters = stepExecution.getJobParameters();
      		Map<String, JobParameter> nameToParameter = jobParameters.getParameters();
      		nameToParameter.put("filePath", new JobParameter(uploadedUmalusiFilePath));
      		return ExitStatus.COMPLETED;
      	}
      
      	@Override
      	public void beforeStep(StepExecution stepExecution) {
      		umalusiFileName = stepExecution.getJobParameters().getString("filename");
      		ftpServer = new FtpUmalusiWrapper();
      	}
      My configuration is:

      Code:
      	<batch:job id="CertificationFileImportJob">
      	
      		<batch:step id="UploadFileUsingFTP">
      			<fail on="FAILED" exit-code="EARLY TERMINATION" />
      			<next on="COMPLETED" to="DataIntegrityChecking" />
      			<batch:tasklet ref="uploadUmalusiFile">
      			
      			</batch:tasklet>
      		</batch:step>	
      
      		<batch:listeners>
      			<batch:listener ref="uploadUmalusiFile" />
      		</batch:listeners>

      Comment


      • #18
        JobParameters are immutable so trying to add a new one like this is not going to work. If I were you I'd start a new thread, since this actually has nothing to do with the previous discussion.

        Comment


        • #19
          I am trying to use chunk in my program. I have written all my code inside the reader class. I am getting the following error:

          ERROR [core.step.AbstractStep] - Encountered an error executing the step
          java.lang.NullPointerException
          at in.gov.uidai.server.batch.impl.tasklet.mytest.RegA utoApproveReader.read(AutoApproveReader.java:106)
          at in.gov.uidai.server.batch.impl.tasklet.mytest.RegA utoApproveReader.read(AutoApproveReader.java:1)
          at org.springframework.batch.core.step.item.SimpleChu nkProvider.doRead(SimpleChunkProvider.java:90)
          at org.springframework.batch.core.step.item.SimpleChu nkProvider.read(SimpleChunkProvider.java:148)
          at org.springframework.batch.core.step.item.SimpleChu nkProvider$1.doInIteration(SimpleChunkProvider.jav a:108)
          at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367)
          at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214)
          at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
          at org.springframework.batch.core.step.item.SimpleChu nkProvider.provide(SimpleChunkProvider.java:103)
          at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:68)
          at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:371)
          at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:128)
          at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:263)
          at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
          at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367)
          at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214)
          at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
          at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:248)
          at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:195)
          at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:135)
          at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61)
          at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
          at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
          at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
          at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:135)
          at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
          at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
          at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:49)
          at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:114)
          at in.gov.Test.server.holdres.jobs.TestAutoApproveJob .execute(EnrollmentHoldRegAutoApproveJob.java:52)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:1 99)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:549)

          What might be the reason for this.

          Comment

          Working...
          X