Mybatis提示Cannot find class [org.mybatis.spring.mapper.MapperScannerConfigurer]

来源:互联网 发布:centos 7 编译安装git 编辑:程序博客网 时间:2024/04/24 15:08

Mybatis提示Cannot find class [org.mybatis.spring.mapper.MapperScannerConfigurer]10

如题:mybatis提示如下异常,是什么原因? 
by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.mybatis.spring.mapper.MapperScannerConfigurer] for bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [applicationContext-mybatis.xml]; nested exception is java.lang.ClassNotFoundException: org.mybatis.spring.mapper.MapperScannerConfigurer 


mybatis相关配置: 
<!-- scan for mappers and let them be autowired --> 
   <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> 
       <property name="basePackage" value="com.hft.dal.mapper" /> 
       <property name="markerInterface" value="com.hft.dal.SqlMapper" /> 
   </bean> 

问题补充:忘记说,这个是mybatis与spring整合
MyBatis 
2013年7月05日 10:51
  • Comment添加评论
  • 关注(0)

4个答案按时间排序按投票排序

00

采纳的答案

解压mybatis-spring1.0.0-RC2.jar,看其中是否有org.mybatis.spring.mapper.MapperScannerConfigurer这个类,若没有换个版本,http://www.jarvana.com/jarvana/archive-details/org/mybatis/mybatis-spring/1.0.2/mybatis-spring-1.0.2.jar

2013年7月05日 11:04
  • Comment3条评论
00

先看你加载的classpath,然后再看里面的jar包有没相应的class,可能是你的jar包版本不一致

2013年7月05日 16:46
  • Comment1条评论
00

刚搭建的框架吧? 
如果读不到任何一个配置文件,就会抛出这个异常。

2013年7月05日 15:36
  • Comment2条评论
00

把引入的包贴出来看看,顺便把错误日志贴上来,内容多点,不然这样只会认为是缺少包。

2013年7月05日 13:45
    0 0
    原创粉丝点击