Mapped Statements collection does not contain value for
2016-10-11 18:41
429 查看
Mapped Statements collection does not contain value for后面是什么类什么方法之类的:
错误原因有几种:
1、mapper.xml中没有加入namespace
2、mapper.xml中的方法和接口mapper的方法不对应
3、mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外
4、mapper.xml文件名和所写的mapper名称不相同。
我遇到的问题是用maven管理mybatis项目。报Mapped Statements collection does not
contain value for的错误,找了半天原因,发现部署后没有Mapper.xml文件,因为.xml文件在java目录中而不是resources目录下,所以没有被认为是资源文件而被部署。在pom.xml中配置一下
红色字体是针对本次问题起作用的地方。当然,最好都配置上。
错误原因有几种:
1、mapper.xml中没有加入namespace
2、mapper.xml中的方法和接口mapper的方法不对应
3、mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外
4、mapper.xml文件名和所写的mapper名称不相同。
我遇到的问题是用maven管理mybatis项目。报Mapped Statements collection does not
contain value for的错误,找了半天原因,发现部署后没有Mapper.xml文件,因为.xml文件在java目录中而不是resources目录下,所以没有被认为是资源文件而被部署。在pom.xml中配置一下
<sourceDirectory>src/main/java</sourceDirectory> <testSourceDirectory>src/test/java</testSourceDirectory> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> </resource> <resource> <!-- 配置需要被替换的资源文件路径 --> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources>
红色字体是针对本次问题起作用的地方。当然,最好都配置上。
相关文章推荐
- mybatis之Mapped Statements collection does not contain value for...错误原因分析
- 针对异常:Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for xxxx mybatis xml maven package install
- Mapped Statements collection does not contain value for真正的解决办法
- Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for RelateMarketingMapper....解决办法
- MyBatis异常java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- 【Mybatis】Mapped Statements collection does not contain value for的解决方案
- 错误信息:Mapped Statements collection does not contain value for ShipperMapper.getSipperlistPage
- 【转】Mapped Statements collection does not contain value for解决
- 解决mybatis,java.lang.IllegalArgumentException Mapped Statements collection does not contain value for
- mybatis:java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for...
- Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for 可能原因
- Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for 之运行异常原因
- Mapped Statements collection does not contain value for
- Mapped Statements collection does not contain value for ResearcherMapper.方法名