Results 1 to 8 of 8

Thread: multi job run problem

  1. #1

    Default 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. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    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.

  3. #3

    Default

    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

  4. #4

    Default 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>

  5. #5
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    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.

  6. #6

    Default

    Quote 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.

  7. #7
    Join Date
    Dec 2006
    Posts
    1,061

    Default

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

  8. #8

    Default

    thank regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •