Announcement Announcement Module
Collapse
No announcement yet.
multi job run problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • multi job run problem

    I run 2 jobs like that :

    jobLauncher.run( (Job) beanFactory.getBean("geckoAlimentationJob"), new JobParameters() );
    --> this job load data from a sysbase database and write it in a SQL server database

    jobLauncher.run( (Job) beanFactory.getBean("clinkAlimentationJob"), new JobParameters());
    --> this job load data from a SQL server database and write it in a SQL server database

    job launcher is SimpleJobLauncher use a task executor class SimpleAsyncTaskExecutor.

    the transaction manager is ResourcelessTransactionManager class.

    and it send me that

    Exception in thread "SimpleAsyncTaskExecutor-1" org.springframework.batch.core.UnexpectedJobExecut ionException: Encountered an error saving batch meta data.


    for each, i use SimpleJob and SimpleStepFactoryBean class.
    readers are JdbcCursorItemReader
    writers are ItemWriter delegate to BatchSqlUpdateItemWriter.


    can ou help me ?

    regards.

  • #2
    We'll need a little more detail than that, can you post a full stack trace? (please use code tags)

    I'm also concerned that you're launching the same job twice with new JobParameters(). Spring Batch will assume you're trying to launching the same job twice, or trying to restart the first job. If you want to force a new execution, I would use a timestamp with the current time.

    Comment


    • #3
      thank for your help this is the full stack trace :

      Exception in thread "SimpleAsyncTaskExecutor-1" org.springframework.batch.core.UnexpectedJobExecut ionException: Encountered an error saving batch meta data.
      at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:237)
      at org.springframework.batch.core.job.SimpleJob.execu te(SimpleJob.java:100)
      at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:86)
      at org.springframework.core.task.SimpleAsyncTaskExecu tor$ConcurrencyThrottlingRunnable.run(SimpleAsyncT askExecutor.java:192)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalArgumentException: step executions for given job execution are expected to be already saved
      at org.springframework.util.Assert.notNull(Assert.jav a:112)
      at org.springframework.batch.core.repository.dao.MapS tepExecutionDao.updateStepExecution(MapStepExecuti onDao.java:74)
      at org.springframework.batch.core.repository.support. SimpleJobRepository.saveOrUpdate(SimpleJobReposito ry.java:244)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:310)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:182)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
      at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:107)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy2.saveOrUpdate(Unknown Source)
      at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:214)
      ... 4 more

      Comment


      • #4
        to complete

        I give you my jobs details :
        <bean id="clinkAlimentationJob" class="org.springframework.batch.core.job.SimpleJo b">
        <property name="steps">
        <list>
        <bean
        class="org.springframework.batch.core.step.item.Si mpleStepFactoryBean">
        <property name="transactionManager" ref="transactionManager" />
        <property name="jobRepository" ref="jobRepository" />
        <property name="itemReader" ref="jdbcClinkDealsReader" />
        <property name="itemWriter" ref="clinkToChasingDealsWriter" />
        <property name="commitInterval" value="${batch.size}" />
        <property name="beanName" value="ClinkDealsBean"/>
        </bean>

        </list>
        </property>

        <property name="restartable" value="false" />
        <property name="jobRepository" ref="jobRepository" />
        </bean>


        <bean id="geckoAlimentationJob" class="org.springframework.batch.core.job.SimpleJo b">
        <property name="steps">
        <list>
        <bean
        class="org.springframework.batch.core.step.item.Si mpleStepFactoryBean">
        <property name="transactionManager" ref="transactionManager" />
        <property name="jobRepository" ref="jobRepository" />
        <property name="itemReader" ref="jdbcGeckoDealsReader" />
        <property name="itemWriter" ref="geckoToChasingDealsWriter" />
        <property name="commitInterval" value="${batch.size}" />
        </bean>

        </list>
        </property>

        <property name="restartable" value="false" />
        <property name="jobRepository" ref="jobRepository" />
        </bean>

        Comment


        • #5
          I still think it has to do with running two jobs at the same time with the same job parameters. You're probably getting a different error because of isolation level errors. I would try running each job separately to see what happens, you'll probably see a JobExecutionAlreadyRunningException.

          Also, please put code into a code tag before posting, as it makes it easier to read.

          Comment


          • #6
            Originally posted by lucasward View Post
            I still think it has to do with running two jobs at the same time with the same job parameters. You're probably getting a different error because of isolation level errors. I would try running each job separately to see what happens, you'll probably see a JobExecutionAlreadyRunningException.

            Also, please put code into a code tag before posting, as it makes it easier to read.
            how to make code tage ?

            thanks.

            Comment


            • #7
              There's a button at the top, it looks like a pound sign. Or just put brackets around the word CODE

              Comment


              • #8
                thank regards

                Comment

                Working...
                X