MyBatis MySQL maven项目报错解决

1.java不支持发行版本5

对于当前引用的maven/jar包,jdk的版本过高,可以换成低版本比如jdk1.8

2.Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource xxx

Idea不能自动解析java文件夹下的xml文件 解决:pom.xml文件中添加

<build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

3.Mapped Statements collection does not contain value for

检查mapper.xml中配置是否正确,比如namespace resultType 全类名等

4.mybatis运行报错:The server time zone value…

解决:需要在url配置中加上时区设置

jdbc:mysql://localhost:3306/eesy?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC

5.org.apache.ibatis.binding.BindingException: Type interface XXX is not known to the MapperRegistry

解决:conf.xml或者mapper.xml中的mapper接口、xml文件路径不对 比如 mapper.xml 中的namespace没有配置接口,导致调用getMapper(class)没有找到接口

6.is not known to the MapperRegistry

解决方案类似5

7.Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error par

解决:配置文件有错误 比如settings属性写错了 还有比如把xml中property的属性写到properties文件中时,需要把url中的&am p;换为&

经验分享 程序员 微信小程序 职场和发展