Spring_错误 java.sql.SQLException: Lock wait timeout exceeded | CannotAcquireLockException 的解决
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) {
Spring_错误 java.sql.SQLException: Lock wait timeout exceeded | CannotAcquireLockException 的解决的更多相关文章
- 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 ...
- java.sql.SQLException: Lock wait timeout exceeded --转
org.springframework.dao.CannotAcquireLockException 的解决> 直接上 bug 的详细信息: 2012-03-12 15:20:31 XmlBea ...
- MySql系列:中文写入数据库出现错误java.sql.SQLException: Incorrect string value: '\xE5\xxxx' for column 'xxxx' at row 1及其解决方法
在将kft-activiti-demo的数据库连接改为mysql之后,可以正常登陆,但是在新建请假流程的时候出现如下错误: Caused by: java.sql.SQLException: In ...
- 出现java.sql.SQLException: No suitable driver的几种解决办法
今天在用C3p0连接MySql数据库 这个时候出现了上面的错误, 一般来说这种错误有3个方向解决 一般都是db的配置的问题 ,一定要小心DB 的配置 八月 19, 2017 8:30:46 下午 co ...
- Mysql错误:ERROR 1205 (HY000): 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 ...
- 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 ...
随机推荐
- Struts2_day03
一.上节回顾 1 在action获取表单提交数据 (1)使用ActionContext类获取 (2)使用ServletActionContext类获取 (3)接口注入 2 结果配置 (1)全局结果页面 ...
- python中的__enter__ __exit__
我们前面文章介绍了迭代器和可迭代对象,这次介绍python的上下文管理.在python中实现了__enter__和__exit__方法,即支持上下文管理器协议.上下文管理器就是支持上下文管理器协议的对 ...
- 运动规划——PT and PVT 模式
最近项目成员在做机器人上层开发时,经常说到PT模式和PVT模式.一直没搞懂这两种模式的实际差别.上网检索进行学习...... ref link:https://blog.csdn.net/m0_376 ...
- Shell-遍历删除指定目录
Code: find $LibPath/ -name .svn | xargs rm -rf
- [WC2008]游览计划 「斯坦那树模板」
斯坦那树 百度释义 斯坦纳树问题是组合优化问题,与最小生成树相似,是最短网络的一种.最小生成树是在给定的点集和边中寻求最短网络使所有点连通.而最小斯坦纳树允许在给定点外增加额外的点,使生成的最短网络开 ...
- java 持有对象总结
java提供了大量的持有对象的方式: 1)数组将数字和对象联系起来,它保存类型明确的对象,查询对象时,不需要对结果做类型转换,它可以时多维的,可以保存基本数据类型的数据,但是,数组一旦生成,其容量就不 ...
- dojo/domReady! 中感叹号的作用
废话 其实不算个技术问题,但实在是花了我不少时间,不记下来都对不起我这浪费掉的几十分钟. 问题 在dojo官网上看教程,跟着做点练习,看到Dojo DOM Functions那节,有一个练习是改变页面 ...
- Redux 和 ngrx 创建更佳的 Angular 2
Redux 和 ngrx 创建更佳的 Angular 2 翻译:使用 Redux 和 ngrx 创建更佳的 Angular 2 原文地址:http://onehungrymind.com/build- ...
- UEFI启动
uefi是一种更快捷快速的电脑启动配置,它的全称是“统一可扩展固件接口”(Unified Extensible Firmware Interface) 要详细了解uefi之前,我们不得不从bios说起 ...
- ref:web security最新学习资料收集
ref:https://chybeta.github.io/2017/08/19/Web-Security-Learning/ ref:https://github.com/CHYbeta/Web-S ...