Results 1 to 4 of 4

Thread: Job Already Running Exception

  1. #1

    Default Job Already Running Exception

    Hi,

    I'm using hibernate + spring batch to read file and store it into DB (oracle). i had written main method to create Job. I'm successfully able to load applicationContext.xml but after that it throws me following exception

    HTML Code:
    org.springframework.batch.core.repository.JobExecutionAlreadyRunningException: A job execution for this job is already running: JobInstance: id=142, JobParameters=[{}], Job=[CCXPACCodeBatchJob]
    	at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:112)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy0.createJobExecution(Unknown Source)
    	at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:98)
    	at com.phs.ihis.batch.InitBatch.main(InitBatch.java:70)
    In database there is no record existing. I suppose that it is having an uncommited instance in session since at the point of exception it already intialised new job instance. So i debug the code and found that it checking for end date to decide whether the job is already running or not.

    But why it is checking for end date for the job instance created by the current execution context ...?

    Am i doing something wrong ?

    Regards
    Gaurav

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    How is your transaction manager configured? Which implementation are you using?

  3. #3
    Join Date
    Jul 2010
    Posts
    12

    Default

    Hello everyone,
    revived the post because I have the same problem and I can not find the solution

    I think depends on the configuration of my TransactionManager
    place the declaration of the bean TransactionManager
    Code:
    <bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
    thanks in advance

  4. #4
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    You can't use Hibernate with a ResourcelessTransactionManager.

Posting Permissions

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