Spring Batch
  1. Spring Batch
  2. BATCH-2034

'Job cannot be null' exception when starting FlowStep remotely with org.springframework.batch.integration.partition.StepExecutionRequestHandler

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 2.2.0.RC2
    • Fix Version/s: 3.0.0
    • Component/s: Core
    • Labels:
      None

      Description

      I have a project which uses
      org.springframework.batch.integration.partition.MessageChannelPartitionHandler
      and
      org.springframework.batch.integration.partition.StepExecutionRequestHandler
      to run a job Step remotely.
      In case if a remote step is a
      org.springframework.batch.core.job.flow.FlowStep
      (not a TaskletStep) the step execution fails on a remote host with the exception:

      Caused by: java.lang.IllegalArgumentException: Job cannot be null.
      at org.springframework.util.Assert.notNull(Assert.java:112)
      at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.findJobExecutions(JdbcJobExecutionDao.java:127)
      at org.springframework.batch.core.repository.support.SimpleJobRepository.getStepExecutionCount(SimpleJobRepository.java:249)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy48.getStepExecutionCount(Unknown Source)
      at org.springframework.batch.core.job.flow.JobFlowExecutor.isStepRestart(JobFlowExecutor.java:82)
      at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:63)
      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:152)

      The reason is an empty jobInstance field in the JobExecution instance used to lookup for the JobExecution on a remote host in
      JdbcJobExecutionDao.findJobExecutions(JobInstance job);

      The SimpleJobExplorer doesn't fill the jobInstance field of the jobExecution received from a DAO call in the SimpleJobExplorer.getStepExecution(Long jobExecutionId, Long executionId) method.

        Activity

        Hide
        Sergey Shcherbakov added a comment -

        Here is a pull request with a fix:
        https://github.com/SpringSource/spring-batch/pull/174

        Show
        Sergey Shcherbakov added a comment - Here is a pull request with a fix: https://github.com/SpringSource/spring-batch/pull/174

          People

          • Assignee:
            Michael Minella
            Reporter:
            Sergey Shcherbakov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: