Arnold Galovics created FINERACT-2194:
-----------------------------------------

             Summary: Batch jobs are failing in a multitenant environment
                 Key: FINERACT-2194
                 URL: https://issues.apache.org/jira/browse/FINERACT-2194
             Project: Apache Fineract
          Issue Type: Bug
            Reporter: Arnold Galovics


When having 2 tenants configured, upon starting up Fineract, batch jobs are 
starting to immediately throw exceptions and fail with the following exception 
trace:

 
{code:java}
org.quartz.JobExecutionException: 
exitCode=FAILED;exitDescription=org.springframework.batch.core.step.FatalStepExecutionException:
 JobRepository failure forcing rollback       at 
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:447)
       at 
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:312)
       at 
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
    at 
org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:255)
     at 
org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:82)
      at 
org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:369)
       at 
org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:206)
     at 
org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:140)
     at 
org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:240)
      at 
org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:229) 
     at 
org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:153)
  at 
org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:418) 
     at 
org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:132)   at 
org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:317) at 
org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:157)
    at 
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
     at 
org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:148)
      at 
org.springframework.batch.core.launch.support.TaskExecutorJobLauncher.run(TaskExecutorJobLauncher.java:59)
   at 
org.apache.fineract.infrastructure.jobs.service.JobStarter.run(JobStarter.java:96)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
     at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:568)   at 
org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:285)        at 
org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269)
      at 
org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)        at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)Caused
 by: org.springframework.dao.OptimisticLockingFailureException: Attempt to 
update step execution id=43 with wrong version (2), where current version is 1 
at 
org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.updateStepExecution(JdbcStepExecutionDao.java:291)
        at 
org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:230)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
     at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:568)   at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:355)
   at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
    at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at 
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379)
      at 
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
   at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
    at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
     at jdk.proxy2/jdk.proxy2.$Proxy292.update(Unknown Source)       at 
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:440)
       ... 27 more
        at 
org.apache.fineract.infrastructure.jobs.service.JobStarter.run(JobStarter.java:98)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
     at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:568)   at 
org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:285)        at 
org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269)
      at 
org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)        at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to