`
cry615
  • 浏览: 153434 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

java.lang.IllegalArgumentException: Mapped Statements collection does not contai

 
阅读更多
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.XX.dao.UserMapper.getUserList
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)
	... 50 more

 

 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.XX.dao.UserMapper.getUserList
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)

 最近在用mybatis出现上次错误,原因:

<!-- define the SqlSessionFactory -->
	<bean id="sqlSessionFactory"
		class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<!--<property name="configLocation" value="classpath:mybatis-conf.xml" />-->
		<property name="typeAliasesPackage" value="com.XX" />
	</bean>

sqlSessionFactory上并未注册或获取到*mapper.xml里面的sql语句信息,造成这个原因无非就是:

*mapper.xml未找到或里面的sql中跟mapper接口中的方法不对应。

总之,从sqlSessionFactory或xml中入手,很容易揪出错的,而且配置这块经常容易出问题,尤其对mybatis不熟或首次集成的time!

分享到:
评论
1 楼 aiafei0001 2014-10-14  
泪奔,搞不定.搞了几天了..

相关推荐

Global site tag (gtag.js) - Google Analytics