org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: The setting log4jImpl is not known. Make sure you spelled it correctly (case sensitive).
idea报错Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext.xml]:
逐步检查:
spring 容器文件
对每行进行注释发现
只有出现这两行代码才会报错,且dataSource排查过无错
所以问题出现在这段代码:
<property name="configLocation" value="classpath:mybatis-config.xml"/><!--配置 mybatis-config配置文件地址-->
语法没问题,遂检查mybatis-config.xml
各种抠字眼最后发现
setting name=“log4jImpl” value=“LOG4J”
官方给的文档是
改成
问题解决。。。。
起初以为配置log4j的这个name是随意的,idea也没提示logImpl就没在意,但是没想到竟然会报错,logImpl原来是固定的字段。记录一下