当前使用版本(必须填写清楚,否则不予处理)
mybatis-plus-3.1.0.jar mybatis-3.5.0.jar mybatis-spring-2.0.0.jar mybatis-velocity-2.0.jar
该问题是怎么引起的?(最新版上已修复的会直接close掉)
报错: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'statement' in 'class org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy'
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'statement' in 'class org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy'
这个问题很奇怪的是,我们项目中logback root日志级别设置到debug就不报错,info就会报错。 其次是去除 PerformanceInterceptor bean的配置也不报错。 原因个人感觉很像jar冲突,但是实际没看出来啥问题。 貌似和tomcat-jdbc也有关系?
Comment From: miemieYaho
这个异常和我们无关
Comment From: miemieYaho
你还是换个好点的连接池吧 hikaricp 或者 druid
Comment From: chenyulzhh
我也遇到了,我是用的 log4j2 ,
debug单步调试了下,发现性能分析插件里面有如下代码:
if (Proxy.isProxyClass(firstArg.getClass())) { statement = (Statement) SystemMetaObject.forObject(firstArg).getValue("h.statement"); } else { statement = (Statement) firstArg; }
问题出在这个 .getValue("h.statement") 这里
如果我日志没有配置为debug级别,这个地方需要 .getValue("h.delegate.statement"); 才能取到statement对象
为啥多了一层这个代理,跟得我头都晕了,大概好像是 mybatis在创建connect时会去判断日志级别是否debugEnabled,根据这个判断再决定是直接返回 connection 还是 包装一层代理后再返回
我觉得反正这个插件已经废弃了,而且既然要用这个插件,日志级别设置成 非debug 的level,也没有意义