The solution of Org.springframework.dao.CannotAcquireLockException
more information on the bug directly:
2012-03-12 15:20:31 Xmlbeandefinitionreader [INFO] Loading XML Bean definitions from class path resource [Org/springframew ork/jdbc/support/sql-error-codes.xml]2012-03-12 15:20:31 sqlerrorcodesfactory [INFO] SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, Ms-sql, MySQL, Oracle, PostgreSQL, sybase]2012-03-12 15:20:31 exceptionutil [ERROR] Sqlmapclien T operation; SQL []; ---The error occurred in Com/defonds/syncpath/dao/operation.xml. ---The error occurred while applying a parameter map. ---Check the operation.updatesharestatus-inlineparametermap. ---Check the statement (update failed). ---Cause:java.sql.SQLException:Lock wait timeout exceeded; Try restarting transaction; Nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:---The error occurred in Com/defonds/syncpath /dao/operation.xml. ---The error occurred while applying a parameter map. ---Check the operation.updatesharestatus-inlineparametermap. ---Check the statement (update failed). ---Cause:java.sql.SQLException:Lock wait timeout exceeded; Try restarting transactionorg.springframework.dao.CannotAcquireLockException:SqlMapClient operation; SQL []; ---The error occurred in Com/defonds/syncpath/dao/operation.xml. ---The error occurred while applying a parameter map. ---Check the operation.updatesharestatus-inlineparametermap. ---Check the statement (update failed). ---Cause:java.sql.SQLException:Lock wait timeout exceeded; Try restarting transaction; Nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:---The error occurred in Com/defonds/syncpath /dao/operation.xml. ---The error occurred while applying a parameter map. ---Check the operation.updatesharestatus-inlineparametermap. ---Check the statement (update failed). ---Cause:java.sql.SQLException:Lock wait timeout exceeded; Try restarting Transactionat org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate ( Sqlerrorcodesqlexceptiontranslator.java:244) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( abstractfallbacksqlexceptiontranslator.java:72) at Org.springframework.orm.ibatis.SqlMapClientTemplate.execute ( sqlmapclienttemplate.java:212) at Com.defonds.frameworkcommons.dao.BaseDaoImpl.execute (basedaoimpl.java:31) at Com.defonds.frameworkcommons.dao.BaseDaoImpl.update (basedaoimpl.java:97) at Com.defonds.syncpath.service.operation.impl.OperationServiceImpl.revokeSharedFolder (Operationserviceimpl.java : 287) at Com.defonds.syncpath.service.share.impl.ShareServiceImpl.handleRevokeSharedFolder (Shareserviceimpl.java : 312) 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 Com.defonds.interfaceframework.controller.Action.invokeMethod (action.java:256) at COM.DEFONDS.INTERFACEframework.controller.Action.execute (action.java:206) at Com.defonds.interfaceframework.controller.DispatcherServlet.service (dispatcherservlet.java:144) at Com.defonds.syncpath.common.ArcSyncDispatcherServlet.service (arcsyncdispatcherservlet.java:51) at Javax.servlet.http.HttpServlet.service (httpservlet.java:717) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:290) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206) at Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:96) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:76) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:235) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206) at Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:233) at Org.apache.catalIna.core.StandardContextValve.invoke (standardcontextvalve.java:191) at Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:128) at Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102) at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:286) at Org.apache.coyote.http11.Http11Processor.process (http11processor.java:845) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:583) at Org.apache.tomcat.util.net.jioendpoint$worker.run (jioendpoint.java:447) at Java.lang.Thread.run (thread.java:619)
Analysis Reason :
Spring transaction nesting causes deadlocks. Fileserviceimpl embedded in the Operationservice:
Private Operationservice Operationservice;
Fileserviceimpl's Delete method has operations on the MySQL file table, while the Revokesharedfolder method in Operationservice also updates the same table. A transaction is nested, causing a deadlock.
Solution :
The method that currently invokes the transaction is set to Propagation.supports:
@Transactional (propagation=propagation.supports)//by defonds,for bug094537@overridepublic void Delete (int uid, int[] Itemids) {if (itemids! = null && itemids.length > 0) {
Original address: http://www.xuebuyuan.com/958812.html
Java.sql.SQLException:Lock Wait timeout exceeded--go