返回顶部

收藏

mybatis 并发执行时出现NullPointerException

更多

异常堆栈如下:

### Cause: java.lang.NullPointerException
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)
        at sun.reflect.GeneratedMethodAccessor725.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
        ... 87 more
Caused by: java.lang.NullPointerException
        at org.apache.ibatis.reflection.property.PropertyTokenizer.<init>(PropertyTokenizer.java:27)
        at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:114)
        at org.apache.ibatis.builder.xml.dynamic.DynamicContext$ContextMap.get(DynamicContext.java:89)
        at org.apache.ibatis.builder.xml.dynamic.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:107)
        at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
        at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:92)
        at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
        at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
        at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
        at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
        at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
        at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:333)
        at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:413)
        at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:395)
        at org.apache.ibatis.builder.xml.dynamic.OgnlCache.getValue(OgnlCache.java:42)
        at org.apache.ibatis.builder.xml.dynamic.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:32)
        at org.apache.ibatis.builder.xml.dynamic.IfSqlNode.apply(IfSqlNode.java:30)
        at org.apache.ibatis.builder.xml.dynamic.MixedSqlNode.apply(MixedSqlNode.java:29)
        at org.apache.ibatis.builder.xml.dynamic.TrimSqlNode.apply(TrimSqlNode.java:42)
        at org.apache.ibatis.builder.xml.dynamic.MixedSqlNode.apply(MixedSqlNode.java:29)
        at org.apache.ibatis.builder.xml.dynamic.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:37)
        at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:241)
        at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:61)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:36)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:42)
        at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:348)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:43)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)
        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
        ... 92 more

这是mybatis依赖包OGNL 2.6.9的一个bug,可以通过升级mybatis版本到 3.3.0来解决此问题。

mybatis官方issue说明: https://github.com/mybatis/mybatis-3/issues/224

标签:mybatis,java

收藏

0人收藏

支持

0

反对

0

相关聚客文章
  1. www.tonitech.com的站长 发表 2014-03-05 06:47:20 mybatis generator自动生成代码报The error occurred while p
  2. 博主 发表 2016-04-26 09:40:55 Id Generator实现方案
  3. 博主 发表 2017-05-09 07:21:00 Generate Java Code with MyBatis Generator
  4. www.tonitech.com的站长 发表 2014-03-10 04:58:06 log4j:WARN No appenders could be found for logger
  5. Harries 发表 2016-09-08 01:47:02 MyBatis介绍
  6. coderbee 发表 2015-09-13 14:10:41 隐式类型转换导致全表扫描
  7. zhu329599788@126 发表 2017-01-11 04:06:34 MyBatis 轻量级Java ORM框架
  8. honway 发表 2015-01-02 15:22:09 MyBatis入门
  9. 博主 发表 2017-05-30 16:06:59 MyBatis-Generator最佳实践
  10. 漠然 发表 2015-07-23 06:25:19 MyBatia 笔记
  11. buzheng 发表 2013-12-18 02:47:29 MyBatis 物理分页插件
  12. 博主 发表 2015-02-25 15:47:55 MyBatis-Generator最佳实践

发表评论