http://blog.csdn.net/witsmakemen/article/details/46913425
在Idea编辑其中配置使用Mybatis出现BuilderException问题,问题描述如下:
[plain] view plain copy
问题:在编译后的target文件夹下,发现只有mapper的class文件,而没有xml文件,将对应的xml文件放到这个文件夹下运行就不会出现下面的错误。说明出现这个错误的原因是maven编译时没有将xml文件放进去。
解决方法:在pom.xml中添加如下代码
[html] view plain copy
码如下:
Java代码
执行之后报错:
Java代码
说明:在项目src/main/resources目录下存在configuration.xml这个文件。
http://stackoverflow.com/questions/19730026/mybatisibatis-xml-mapping-configuration
1
I'm using MyBatis 3.2.2 and I have problems loading XML mappers as resources. <mappers> <mapper resource="src/main/resources/Conference.xml" /> </mappers> |
---|
1
I'm using MyBatis 3.2.2 and I have problems loading XML mappers as resources. <mappers> <mapper resource="src/main/resources/Conference.xml" /> </mappers> Exception nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource src/main/resources/Conference.xml |
---|
1 down vote accepted
You are using Maven, so you can leave off the src/main/resources path altogether, as Conference.xml will be found at the root of your classpath. This should work: <mappers> <mapper resource="Conference.xml" /> </mappers> |
---|