在idea中mybatis错误(1)

错误提示为:

### Error building SqlSession.
### The error may exist in cn/qd/mybatis/map/productMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource cn/qd/mybatis/map/productMapper.xml

问题:在全局配置文件Configure.xml

<mappers>
<mapper resource="cn/qd/mybatis/map/productMapper.xml"/>
</mappers>
无法找到资源的路径,在idea中貌似无法识别productMapper.xml

问题解决:既然找不到.xml文件,那么就在maven编译时将.xml文件放进去。即:在pom.xml文件的<build>标签中,加入
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>

原文出自:http://blog.csdn.net/witsmakemen/article/details/46913425

posted on 2016-11-06 11:09  新freedom  阅读(...)  评论(...编辑  收藏

导航