解决 Mybatis报错org.apache.ibatis.ognl.NoSuchPropertyException: XXXCriteria$Criterion.noValue
问题
这个noValue一定存在,但是报错。
场景就是存在并发的情况下,尤其是在服务刚刚启动的时候,就会发生这个异常。
但是很不幸,mybatis 3.4.1之前,用的 OGNL都是由这个问题。
分析
3.4.1 之前的版本的 OgnlRuntime,这里,第三个参数传0,则永远都是null。
public static final Object getMethodValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException {
Object result = null;
Method m = getGetMethod(context, target == null ? null : target.getClass(), propertyName);
if (m == null) {
m = getReadMethod(target == null ? null : target.getClass(), propertyName, 0);
}
3.4.1 以及以后的版本:
public static final Object getMethodValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException {
Object result = null;
Method m = getGetMethod(context, target == null ? null : target.getClass(), propertyName);
if (m == null) {
m = getReadMethod(target == null ? null : target.getClass(), propertyName, (Class[])null);
}
显然 getReadMethod 这个地方的实现已经完全发生改变。
而
getGetMethod 存在 并发问题,线程不安全。
解决 Mybatis报错org.apache.ibatis.ognl.NoSuchPropertyException: XXXCriteria$Criterion.noValue的更多相关文章
- 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String'
最近在练习MyBatis时 进行姓名的模糊查询时候出现 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da ...
- Maven项目使用mybatis报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
maven项目使用mybatis时,找不到mapper文件(.xml) 错误信息提示: 项目可以正常运行,但是在有请求到达服务器时(有访问数据库的请求),会出现报错!! 错误原因: mybatis没有 ...
- MyBatis 报错org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource
报错如下: org.apache.ibatis.exceptions.PersistenceException: ### Error opening session. Cause: java.lang ...
- 报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.
报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMa ...
- maven 项目报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决
idea在使用maven构建的项目中使用mybatis时报错org.apache.ibatis.binding.BindingException: Invalid bound statement (n ...
- 解决Mybatis 报错Invalid bound statement (not found)
解决Mybatis 报错Invalid bound statement (not found) 出现此错误的原因 1.xml文件不存在 2.xml文件和mapper没有映射上 namespace指定映 ...
- 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'
mybatis查询报错: Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for pro ...
- mybatis plus 报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 少了个范型
- maven项目 报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
ssm的项目如果在mapper.xml mapper接口 配置没问题的情况下 项目依然报org.apache.ibatis.binding.BindingException: Invalid bo ...
随机推荐
- APP自動化測試腳本1
package com.lemon.day01; import java.net.MalformedURLException; import java.net.URL; import java.uti ...
- 在Docker中启动Cloudera
写在前面 记录一下,一个简单的cloudera处理平台的构建过程和一些基本组件的使用 前置说明 需要一台安装有Docker的机器 docker常用命令: docker ps docker ps -a ...
- Mycat 配置文件server.xml
server.xml 几乎保存了所有 mycat 需要的系统配置信息. 1.system 标签: 该标签内嵌套的所有 property 标签都与系统配置有关. charset 属性: 该属性用于字符集 ...
- Java8新特性——接口默认方法
Java 8 新增了接口的默认方法. 简单说,默认方法就是接口可以有实现方法,而且不需要实现类去实现其方法. 我们只需在方法名前面加个default关键字即可实现默认方法. 为什么要有这个特性? 首先 ...
- jQuery常用方法(一)-基础
$("p").addClass(css中定义的样式类型); 给某个元素添加样式 $("img").attr({src:"test.jpg", ...
- 更该clover软件图标(任务栏显示)
1.首先介绍一个Clover软件,Clover 的功能就是给资源管理器加上 Chrome 一样的标签页,像下面这样,你会爱上它的效率,和浏览器一样的操作方式. 2.它自带的系统图标比较丑(虽然作者说挺 ...
- 如何评价一个VR体验设计?
如何评价一个VR系统的体验是好是坏?或者说,哪些因素会破坏一个VR的体验? Kruij和Riecke教授在IEEE VR会议上提到了四个角度:Congnition,Game User Experien ...
- Django基础五之django模型层之关联管理器
class RelatedManager "关联管理器"是在一对多或者多对多的关联上下文中使用的管理器.它存在于下面两种情况: ForeignKey关系的“另一边”.像这样: 1 ...
- springcloud -- sleuth+zipkin整合rabbitMQ详解
为什么使用RabbitMQ? 我们已经知道,zipkin的原理是服务之间的调用关系会通过HTTP方式上报到zipkin-server端,然后我们再通过zipkin-ui去调用查看追踪服务之间的调用链路 ...
- centos7 安装 docker
一.概念 1.Docker引擎 (docker engine) 也称docker daemon,也称为docker服务,只要启动服务,就可以通过docker client发送相关docker命名,与d ...