2012-08-15 48 views
1


你好,我得到了在春天批處理應用程序Hibernate的代理誤差在Spring Batch的推出工作

ERROR: org.springframework.batch.core.job.AbstractJob - Encountered fatal error executing job 
org.springframework.dao.OptimisticLockingFailureException: Attempt to update job execution id=33 with wrong version (0), where current version is 1 
    at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.updateJobExecution(JdbcJobExecutionDao.java:210) 
    at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:155) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
    at $Proxy54.update(Unknown Source) 
    at org.springframework.batch.core.job.AbstractJob.updateStatus(AbstractJob.java:383) 
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:276) 
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 


休眠錯誤按照錯誤日誌,我面對代理錯誤的摘要工作類(由Spring Batch的提供)
我想,由於抽象作業類沒有任何非參數構造函數,CGLIB不能提供任何代理類。
我該如何解決這個問題?

我使用Spring Batch的管理員現在

回答

0

該異常

org.springframework.dao.OptimisticLockingFailureException: Attempt to update job execution id=33 with wrong version (0), where current version is 1 

意味着,由於某種原因,你的腳步交易鎖定已失敗。

可能導致您的業務邏輯事務被設置爲RollbackOnly模式,這會導致彈簧表狀態不一致,並且會出現樂觀鎖定。

嘗試爲hibernate添加日誌並顯示實際的sql。這可能會幫助您找出問題的實際位置。