解决:org.springframework.dao.CannotAcquireLockException:Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

发生异常!原因是:
org.springframework.dao.CannotAcquireLockException:
### Error updating database.  Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
### The error may exist in com/koal/ipsec/mapper/IpsConnectionMapper.java (best guess)
### The error may involve com.koal.ipsec.mapper.IpsConnectionMapper.updateById-Inline
### The error occurred while setting parameters
### SQL: UPDATE ips_connection  SET name=?, display_name=?, type=?, auth=?, version=?, local_addrs=?, remote_addrs=?,   proposals=?, encap=?, dpd_delay=?, send_certreq=?, send_cert=?, pools=?, children=?, local=?, remote=?, reauth_time=?,  create_time=?,  update_time=?, status=?  WHERE id=?
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:263) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) ~[mybatis-spring-2.0.1.jar!/:2.0.1]
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-2.0.1.jar!/:2.0.1]
        at com.sun.proxy.$Proxy114.update(Unknown Source) ~[?:?]
        at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) ~[mybatis-spring-2.0.1.jar!/:2.0.1]
        at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:63) ~[mybatis-plus-core-3.1.1.jar!/:3.1.1]

navicat下操作


-- 查看mysql 事务处理列表
select * from information_schema.INNODB_TRX  

-- 查看trx_mysql_thread_id 且 kill 
kill 14237
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐