Caused by: org.apache.ibatis.exceptions.PersistenceException
在构建mybatis时运行报如下异常,原因是在mapper.xml中使用了中文注释- java.lang.ExceptionInInitializerError
- at com.XXX.dao.UserMapperTest.test(UserMapperTest.java:22)
- Caused by: org.apache.ibatis.exceptions.PersistenceException:
- ###Error building SqlSession.
- ###The error may exist in com/XXX/dao/UserMapper.xml
复制代码 ***查找到的处置方法:
1、删除中文注释(胜利)
2、在注释内容前后加两个空格(失败)
3、将XML文件的编码格式encoding="UTF-8"换成encoding=“GBK”(胜利)
4、更改IDEA统一编码(胜利)
settings->Editor->File Encoding 编码改为UTF-8,APPLY后,将Mapper.xml删除,重新创建,且XML文件编码仍为UTF-8。***
|
|
|
|
|