MyBatis日志log4j异常ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColum

时间:2021-07-05 21:42:10

具体异常:

log4j:ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColumnBehaviorTest$LastEventSavedAppender].

java.lang.ClassNotFoundException: org.apache.ibatis.session.AutoMappingUnknownColumnBehaviorTest$LastEventSavedAppender

异常分析:无法将org.apache.ibatis.session.AutoMappingUnknownColumnBehaviorTest实例化为LastEventSavedAppender

实际原因:直接把mybatis目录下的官方log4j.properties直接拿来用了,下图是官方资源的log4j.properties

(mybatis-3-mybatis-x.x..x src\test\java目录下)MyBatis日志log4j异常ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColum

解决方法:把WARN后的内容去掉

查看官方网址(http://www.mybatis.org/mybatis-3/configuration.html)也可知AutoMappingUnkownColumnBehavior只可取NONE,WARNING,FAILING三个值,默认值为NONEMyBatis日志log4j异常ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColum