Announcement Announcement Module
Collapse
No announcement yet.
JobExecution must already be saved Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JobExecution must already be saved

    Hi there, i am using quartz scheduler to run a spring batch job. Below is some error that i get while trying to run more than 1 job in the same time using quartz scheduling.

    I would like to know whether is my configuration is the one that cause the problem?

    What will be the cause of this error that come out when the 2 job is running in the same time?

    ERROR 2009-10-07 19:40:00,024 [org.springframework.batch.core.job.AbstractJob] - Encountered fatal error executing job
    java.lang.IllegalArgumentException: JobExecution must already be saved
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.batch.core.repository.dao.MapJ obExecutionDao.updateJobExecution(MapJobExecutionD ao.java:89)
    at org.springframework.batch.core.repository.support. SimpleJobRepository.update(SimpleJobRepository.jav a:151)
    at sun.reflect.GeneratedMethodAccessor41.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:307)
    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:106)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy27.update(Unknown Source)
    at org.springframework.batch.core.job.AbstractJob.upd ateStatus(AbstractJob.java:423)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:245)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    java.lang.IllegalArgumentException: JobExecution must already be saved
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.batch.core.repository.dao.MapJ obExecutionDao.updateJobExecution(MapJobExecutionD ao.java:89)
    at org.springframework.batch.core.repository.support. SimpleJobRepository.update(SimpleJobRepository.jav a:151)
    at sun.reflect.GeneratedMethodAccessor41.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:307)
    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:106)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy27.update(Unknown Source)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:295)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception in thread "pool-1-thread-3" java.lang.IllegalArgumentException: JobExecution must already be saved
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.batch.core.repository.dao.MapJ obExecutionDao.updateJobExecution(MapJobExecutionD ao.java:89)
    at org.springframework.batch.core.repository.support. SimpleJobRepository.update(SimpleJobRepository.jav a:151)
    at sun.reflect.GeneratedMethodAccessor41.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:307)
    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:106)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy27.update(Unknown Source)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:295)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)INFO 2009-10-07 19:40:00,070 [org.springframework.batch.core.job.AbstractJob] - Executing step: [TaskletStep: [name=mt_jpaPagingReaderToFile]]

    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    Below is some sample of configuration i have in my file

    <beans:bean id="jobLauncher"
    class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
    <beansroperty name="jobRepository" ref="jobRepository"/>
    <beansroperty name="taskExecutor" ref="taskExecutor"/>
    </beans:bean>

    <beans:bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.MapJobRepositoryFactoryBean">
    <beansroperty name="transactionManager">
    <beans:bean class="org.springframework.batch.support.transacti on.ResourcelessTransactionManager">
    </beans:bean>
    </beansroperty>
    </beans:bean>

    <beans:bean id="taskExecutor" class="org.springframework.scheduling.concurrent.C oncurrentTaskExecutor">
    </beans:bean>


    <batch:job id="jobA" job-repository="jobRepository">
    <batch:step id="A" next="B">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="aAuditPagingItemReader" writer="jpaItemWriter" processor="updateItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="B" next="C">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="jpaPagingItemReader" writer="flatFileItemWriter" processor="outputItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="C">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="jpaPagingItemReader" writer="jpaItemWriter" processor="updateItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    </batch:job>

    <batch:job id="jobB" job-repository="jobRepository">
    <batch:step id="D" next="E">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="bAuditPagingItemReader" writer="jpaItemWriter" processor="updateItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="E" next="F">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="jpaPagingItemReader" writer="flatFileItemWriter" processor="outputItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="F">
    <batch:tasklet>
    <batch:chunk commit-interval="5000" reader="jpaPagingItemReader" writer="jpaItemWriter" processor="updateItemProcessor"/>
    </batch:tasklet>
    </batch:step>
    </batch:job>
    Last edited by wakamate; Oct 7th, 2009, 11:03 PM.
Working...
X