org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.util.ConcurrentModificationException
### The error may exist in com/mybatis/mapper/UserMapper.xml
### The error may involve com.mybatis.mapper.UserMapper.selCaseSql
### The error occurred while handling results
### SQL: select id AS u_id, username AS u_username , password AS u_password from _user
### Cause: java.util.ConcurrentModificationException
原因:mybatis内部使用标签迭代HashMap的时候报ConcurrentModificationException异常。 通过源码分析,mybatis内部并没有迭代和删除并行,那就只有一种情况,传入mybatis的HashMap,是个全局变量,或者局部变量被其他线程所修改(添加元素或者删除元素),导致mybatis内部迭代的时候出现modCount!=expectedModCount导致异常。 解决方案:传入mybatis的HashMap不要存在异步操作或者全局变量被引入
本文探讨了在使用MyBatis框架时遇到的ConcurrentModificationException异常问题,并深入分析了其产生的原因及解决方法。
1212

被折叠的 条评论
为什么被折叠?



