Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource mapper/StudentMapper.xml

基于mapper接口使用mybatis。出现的报错信息:

org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in mapper/StudentMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource mapper/StudentMapper.xml
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:82)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:66)...

是因为pom.xml中的build中的资源路径不正确导致的。

修改pom.xml文件中的build,如下:

便可成功访问到数据了。

文件各目录如下:

持续的输入与输出。
原文地址:https://www.cnblogs.com/qhm-1440/p/14554724.html