码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis logImpl 学习Error

时间:2020-09-17 21:02:55      阅读:27      评论:0      收藏:0      [点我收藏+]

标签:应该   err   检查   intel   The   nbsp   app   code   tin   

1.Error

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:35)
    at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:28)
    ... 6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at com.intellij.rt.coverage.instrumentation.Instrumentator.performPremain(Instrumentator.java:55)
    at com.intellij.rt.coverage.instrumentation.Instrumentator.premain(Instrumentator.java:33)
    ... 12 more

 

 解决方案

系统给了一推没有的报错信息,这个对与新手来说是比较头疼的事,在配置Mybatis的时候一定要仔细,注意大小写,注意空格,约定大于配置

我发现的这个错误的原因是 value="STDOUT_LOGGING "最后面多了个空格

<settings>
<setting name="logImpl" value="STDOUT_LOGGING "/>
</settings>

测试结果

技术图片

技术图片

 2.Error

Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in SQL Mapper Configuration
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: The setting LogImpl is not known.  Make sure you spelled it correctly (case sensitive).
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
    at com.wanghwei.utils.MybatisUtils.<clinit>(MybatisUtils.java:19)
    ... 23 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: The setting LogImpl is not known.  Make sure you spelled it correctly (case sensitive).
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:122)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
    at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)
    ... 25 more
Caused by: org.apache.ibatis.builder.BuilderException: The setting LogImpl is not known.  Make sure you spelled it correctly (case sensitive).
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.settingsAsProperties(XMLConfigBuilder.java:135)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
    ... 27 more

 解决方案

Caused by: org.apache.ibatis.builder.BuilderException: The setting LogImpl is not known.  Make sure you spelled it correctly (case sensitive).
检查你的setting name="LogImpl"是否正确,确认的应该是logImpl
<settings>
<setting name="LogImpl" value="STDOUT_LOGGING "/>
</settings>

 测试结果

技术图片

技术图片

 3.Error

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.logging.LogException: Error setting Log implementation.  Cause: java.lang.NoClassDefFoundError: org/apache/log4j/Priority

Caused by: org.apache.ibatis.logging.LogException: Error setting Log implementation.  Cause: java.lang.NoClassDefFoundError: org/apache/log4j/Priority

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority

 解决方案

 没有导入Log4J的包,NoClassDefFoundError: org/apache/log4j/Priority

 Maven配置导入包

 

Mybatis logImpl 学习Error

标签:应该   err   检查   intel   The   nbsp   app   code   tin   

原文地址:https://www.cnblogs.com/wanghwei/p/13646992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!