我正在为我的应用程序执行一些集成测试,我试图在数据库中发生更新/插入时强制执行异常。每当由于这个Spring批处理步骤引发的任何异常都会挂起以下异常
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)
尝试在春季论坛中搜索,根据https://jira.spring.io/browse/BATCH-1767似乎是一个错误。
是否有人遇到此问题,是否有任何解决方案? 我在我的应用程序中使用JTA事务管理器,eclipselink和Spring批处理版本2.1.7。