Announcement Announcement Module
Collapse
No announcement yet.
Invoke a spring batch job within another job Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invoke a spring batch job within another job

    Attempted at launching a job through jobLauncher from another spring batch job

    Code:
      Job job = jobRegistry.getJob(jobName);
      JobExecution syncJobExecution = jobLauncher.run(job, syncJp);
    Error:
    [ 2012-12-27 14:08:03,244 ["http-bio-9977"-exec-5] step.AbstractStep.execute():212 ERROR]: [rangasaj] Encountered an error executing the step
    java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
    at org.springframework.batch.core.repository.support. AbstractJobRepositoryFactoryBean$1.invoke(Abstract JobRepositoryFactoryBean.java:164)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy101.createJobExecution(Unknown Source)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:111)
    at deshaw.munshi.geneva.sync.SyncDriver.execute(SyncD river.java:142)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:386)
    at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:130)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:264)
    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:250)
    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)
    .......

    Environment:
    JobRepository : SimpleJobRepository with meta tables stored in database
    dataserver: sql server 2008
    spring-batch : 2.1.8.RELEASE
    spring: 3.1.0.RELEASE

    Let me know if you need more details
Working...
X