org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
### The error may exist in com/lsw/dao/DeptDao.xml
### The error may involve com.lsw.dao.selectAllDept
运行项目时发现如上错误,首先我分析的是由于找不到xml文件导致的报错,于是就去设置mapper文件路径,发现不行,于是就动手去配置maven的pom文件配置,在<build>节点下添加<resources>代码:
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build>
发现依然不能work,后来在检测pom文件时发现 我本机用的sql版本跟我设置的版本不一样,折腾了一个小时多才发现是我的mysql-connector-java.jar包版本过低,换一个匹配版本的jar包即可