OptimisticLockingFailureException Performing update phase after commit failure in Spring Package

I am doing integration testing for my application where I am trying to force an exception whenever an update / insert occurs in the database. Whenever any exception is thrown because of this, Spring's batch step hangs with the below exception.

Caused by: org.springframework.dao.OptimisticLockingFailureException: Attempt to
 update step execution id=10657 with wrong version (1), where current version is
 2
        at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.up
dateStepExecution(JdbcStepExecutionDao.java:185)
        at org.springframework.batch.core.repository.support.SimpleJobRepository
.update(SimpleJobRepository.java:171)
        at sun.reflect.GeneratedMethodAccessor227.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.
proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.
invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy74.update(Unknown Source)
        at org.springframework.batch.core.job.flow.JobFlowExecutor.abandonStepEx
ecution(JobFlowExecutor.java:76)
        at org.springframework.batch.core.job.flow.support.state.StepState.handl
e(StepState.java:59)
        at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(Sim
pleFlow.java:144)

      

Tried searching the Spring Forum and it seems to be a bug at https://jira.spring.io/browse/BATCH-1767 .

Has anyone come across this problem and is there a solution for this? I am using JTA transaction manager, eclipselink and Spring package version 2.1.7 in my application.

+3


source to share





All Articles