Mybatis_PageHelper采用spring方式集成报错

itpkm 发布于 2014/12/27 21:18
阅读 11K+
收藏 0

@Liuzh_533 你好,想跟你请教个问题:

使用spring方式集成,web功能启动的时候报错,错误信息如下:

2014-12-27 21:13:51 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in file [D:\workplace\yhgo\.metadata\.me_tcat\webapps\yhzy\WEB-INF\classes\spring-jdbc.xml]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [D:\workplace\yhgo\.metadata\.me_tcat\webapps\yhzy\WEB-INF\classes\spring-jdbc.xml]: Cannot create inner bean 'com.github.pagehelper.PageHelper#725857cc' of type [com.github.pagehelper.PageHelper] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.PageHelper#725857cc' defined in file [D:\workplace\yhgo\.metadata\.me_tcat\webapps\yhzy\WEB-INF\classes\spring-jdbc.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'properties' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/scripting/xmltags/SqlNode
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)



配置方式如下:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
   <property name="dataSource" ref="dataSource"/>
<property name="mapperLocations">
<list>
  <value>classpath:com/base/dao/mapper/*Mapper.xml</value>
  <value>classpath:com/xuelang/yhzy/dao/mapper/*Mapper.xml</value>
</list>
</property>
<property name="typeAliasesPackage" value="com.xuelang.yhzy.domain"/>
<!-- 分页插件设置 -->
<property name="plugins">
   <array>
     <bean class="com.github.pagehelper.PageHelper">
       <property name="properties">
         <value>
           dialect=mysql
           reasonable=true
           pageSizeZero=true
         </value>
       </property>
     </bean>
   </array>
</property>
</bean>

加载中
0
Liuzh_533
Liuzh_533
你用的Spring版本是什么?看着好像不支持这种写法的properties
返回顶部
顶部