当前位置: 代码迷 >> 综合 >> Error parsing SQL Mapper Cause: java.io.IOException: Could not find resource /com/Dao/UserMapper.xml
  详细解决方案

Error parsing SQL Mapper Cause: java.io.IOException: Could not find resource /com/Dao/UserMapper.xml

热度:33   发布时间:2024-01-24 06:24:43.0

1、mybatis 核心配置文件中,mapper配置时前边多加了“/”,导致找不到配置文件

<mappers><mapper resource="/com/Dao/UserMapper.xml"/>
</mappers>

 

The error may exist in /com/Dao/UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource /com/Dao/UserMapper.xml
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:50)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:33)

 

应为如下:

<mappers><mapper resource="com/Dao/UserMapper.xml"/>
</mappers>

祭祀 加深印象。