zoukankan      html  css  js  c++  java
  • java.sql.SQLException: Lock wait timeout exceeded --转

     org.springframework.dao.CannotAcquireLockException 的解决》

            直接上 bug 的详细信息

    2012-03-12 15:20:31 XmlBeanDefinitionReader [INFO] Loading XML bean definitions from class path resource [org/springframework/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] 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 transaction
    org.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 transaction
    	at 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)

            分析原因

            Spring 事务嵌套造成死锁。FileServiceImpl 里嵌入了 OperationService:

    	private OperationService operationService;

            FileServiceImpl 的 delete 方法里对 MySQL 的 file 表有操作,而 OperationService 里的 revokeSharedFolder 方法也对同一张表有更新操作。事务嵌套,造成死锁。

            解决方案

            当前调用事务的方法设置为 Propagation.SUPPORTS:

    	@Transactional(propagation=Propagation.SUPPORTS)//by Defonds,for BUG094537
    	@Override
    	public void delete(int uid, int[] itemIds) {
    		if (itemIds != null && itemIds.length > 0) {

    原文地址:http://www.xuebuyuan.com/958812.html

  • 相关阅读:
    ubuntu12.04 死机 卡屏 画面冻结解决方案
    Install Firefox 20 in Ubuntu 13.04, Ubuntu 12.10, Ubuntu 12.04, Linux Mint 14 and Linux Mint 13 by PPA
    ListView1.SelectedItems.Clear()
    android studio 下载地址
    jquery.slider.js jquery幻灯片测试
    jquery.hovermenu.js
    jquery.tab.js选项卡效果
    适配 placeholder,jquery版
    jquery.autoscroll.js jquery自动滚动效果
    将 Google Earth 地图集成到自己的窗体上的 简单控件
  • 原文地址:https://www.cnblogs.com/davidwang456/p/4270458.html
Copyright © 2011-2022 走看看