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
java.sql.SQLException: Lock wait timeout exceeded --转的更多相关文章
- Spring_错误 java.sql.SQLException: Lock wait timeout exceeded | CannotAcquireLockException 的解决
java.sql.SQLException: Lock wait timeout exceeded | org.springframework.dao.CannotAcquireLockExcept ...
- java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction问题 1.问题描述 执行了几条update语句 ...
- MySQL应用报错:java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
开发反馈,某业务系统插入一条记录的时候,日志报错,插入失败: ### Error updating database. Cause: java.sql.SQLException: Lock wait ...
- MySQL_事务没有提交导致 锁等待 Lock wait timeout exceeded
java.lang.Exception:### Error updating database. Cause: java.sql.SQLException: Lock wait timeout ex ...
- MySQL 事务没有提交导致 锁等待 Lock wait timeout exceeded
java.lang.Exception: ### Error updating database. Cause: java.sql.SQLException: Lock wait timeout e ...
- 项目中遇到的死锁问题: Lock wait timeout exceeded; try restarting transaction
最近项目中频繁出现 Lock wait timeout exceeded; try restarting transaction这个错误,把我们弄得痛苦不堪啊,为了解决问题,上网上找好多资料,终于把 ...
- Mysql错误: ERROR 1205: Lock wait timeout exceeded解决办法(MySQL锁表、事物锁表的处理方法)
Java执行一个SQL查询未提交,遇到1205错误. java.lang.Exception: ### Error updating database. Cause: java.sql.SQLExc ...
- Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Lock wait timeout exceeded; try restarting transaction
更新的时候报 Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Loc ...
- SQL性能优化常见措施(Lock wait timeout exceeded)
SQL性能优化常见措施 目 录 1.mysql中explain命令使用 2.mysql中mysqldumpslow的使用 3.mysql中修改my.ini配置文件记录日志 4.mysql中如何加索引 ...
随机推荐
- VC C运行时库(CRTL)的几个版本及选用
分类: Windows 2008-12-23 10:01 987人阅读 评论(0) 收藏 举报ciostreammfclibrary多线程import最近做项目碰到了一个关于在动态库中使用MFC以及在 ...
- 【HDOJ】1857 Word Puzzle
trie树.以puzzle做trie树内存不够,从puzzle中直接找串应该会TLE.其实可以将查询组成trie树,离线做.扫描puzzle时注意仅三个方向即可. /* 1857 */ #includ ...
- phpstrom 与 xdebug 配合实现PHP单步调试
不说废话,直接开始. 第一步: 安装并配置xdebug 安装 可以从官网直接下载对应php版本的xdebug,下载地址: https://xdebug.org/download.php 配置,典型的 ...
- linux 失败无连接 检查电缆吗
将BOOTPROTO=dhcp改成 BOOTPROTO=static 改成手动获取IP的模式 原因: 虚拟机中的Linux目前是默认设成的自动获取IP设置,但你的网络中没有DHCP服务,所以会显示“正 ...
- 【转】Android 4.4源码下载与编译
原文网址:http://www.cnblogs.com/zhx831/p/3550830.html 这篇文章记录了我下载源码和编译的全过程, 全过程参考Android官方文档 1. 下载Android ...
- javascript 中concat与push的区别
1. push 遇到数组参数时,把整个数组参数作为一个元素:而 concat 则是拆开数组参数,一个元素一个元素地加进去. 2. push 直接改变当前数组:concat 不改变当前数组. 总结:如果 ...
- PL/SQL连接查询数据报错时Dynamic Performance Tables not accessible
一.产生该提示原因plsql dev在用户运行过程中,要收集用户统计信息,但是由于你现在登录的用户没有访问v$session,v$sesstat and v$statname视图的权限,所以不能收集当 ...
- SQL Server查询性能优化——覆盖索引(二)
在SQL Server 查询性能优化——覆盖索引(一)中讲了覆盖索引的一些理论. 本文将具体讲一下使用不同索引对查询性能的影响. 下面通过实例,来查看不同的索引结构,如聚集索引.非聚集索引.组合索引等 ...
- mysql 5.5 中的示例数据库 employees
http://dev.mysql.com/doc/employee/en/employees-installation.html
- Ubuntu14.04安装Oracle12C
原文:http://www.techienote.com/2014/04/how-to-install-oracle-12c-enterprise-edition-database-ubuntu-13 ...