Announcement Announcement Module
Collapse
No announcement yet.
Job Already Running Exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    How is your transaction manager configured? Which implementation are you using?

    Comment


    • #3
      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

      Comment


      • #4
        You can't use Hibernate with a ResourcelessTransactionManager.

        Comment

        Working...
        X