Mapped Statements collection does not contain value

最近一个项目在启动的时候,当需要访问service时,报错了,出现如下错误:

分析:我们的service不应该跟mybatis有什么关系,而异常中说我们的servcie不符合mybatis的映射规则。

所以应该是spring和mybatis整合的时候,把我们的service也当成普通的mapper扫描进去了。

核查配置文件发现(改配置扫描了项目上所有的包,需要缩小范围):

    
    

改为如下即可

    
    
严重: Servlet.service() for servlet [dispatcher] in context with path [/certtrustweb] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.xxx.certtrustweb.service.MakeCertService.makeCertByFisrtTime] with root cause
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxxx.certtrustweb.service.MakeCertService.makeCertByFisrtTime
	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.(MapperMethod.java:176)
	at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:38)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)
	at com.sun.proxy.$Proxy29.makeCertByFisrtTime(Unknown Source)

你可能感兴趣的:(javaweb_实践问题汇总)