文章目录
一、导入mybatis文件mybatis-config.xml报红
IDEA中在编辑mybatis-config文件时候,http://mybatis.org/dtd/mybatis-3-config.dtd 报红
解决:
OK:👇🏾
二、Unable to import maven project: See logs for details
换个低版本的 maven ,比如 apache-maven-3.5.4 或者apache-maven-3.6.0-bin ,这里一般是 idea2019.1 与高版本的 maven (apache-maven-3.8.2 )不太兼容导致的。
三、绑定异常
org.apache.ibatis.binding.BindingException: Type interface com.zql.dao.UserMapper is not known to the MapperRegistry.
解决 👇🏾:
四、java.lang.ExceptionInInitializerError
maven由于他的约定大于配置,导致无法导出或生效问题
4.1 第一种报错
4.2 第二种报错(java.io.IOException: Could not find resource mybatis-config.xml )
解决 👇🏾:
<!--在build中配置resources,来防止我们资源导出失败的问题-->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
五、set标签问题
org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'gprice = 9999.0
解决:set 标签中缺少逗号