NutzCN Logo
问答 关于spring整合mybatis,添加pagehelper插件,启动报错了
发布于 336天前 作者 qq_6427b776 784 次浏览 复制 上一个帖子 下一个帖子
标签:

求各位大神指导

mybatis-setting.xml
<?xml version="1.0" encoding="UTF-8" ?>  
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
	<settings>
		<setting name="lazyLoadingEnabled" value="true" />
		<setting name="aggressiveLazyLoading" value="false" />
	</settings>
	<plugins>
		<!-- com.github.pagehelper为PageHelper类所在包名 -->
		<plugin interceptor="com.github.pagehelper.PageHelper">
			<!-- 4.0.0以后版本可以不设置该参数 -->
			<property name="dialect" value="mysql" />
			<!-- 该参数默认为false -->
			<!-- 设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用 -->
			<!-- 和startPage中的pageNum效果一样 -->
			<property name="offsetAsPageNum" value="true" />
			<!-- 该参数默认为false -->
			<!-- 设置为true时,使用RowBounds分页会进行count查询 -->
			<property name="rowBoundsWithCount" value="true" />
			<!-- 设置为true时,如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 -->
			<!-- (相当于没有执行分页查询,但是返回结果仍然是Page类型) -->
			<property name="pageSizeZero" value="true" />
			<!-- 3.3.0版本可用 - 分页参数合理化,默认false禁用 -->
			<!-- 启用合理化时,如果pageNum<1会查询第一页,如果pageNum>pages会查询最后一页 -->
			<!-- 禁用合理化时,如果pageNum<1或pageNum>pages会返回空数据 -->
			<property name="reasonable" value="true" />
			<!-- 3.5.0版本可用 - 为了支持startPage(Object params)方法 -->
			<!-- 增加了一个`params`参数来配置参数映射,用于从Map或ServletRequest中取值 -->
			<!-- 可以配置pageNum,pageSize,count,pageSizeZero,reasonable,orderBy,不配置映射的用默认值 -->
			<!-- 不理解该含义的前提下,不要随便复制该配置 -->
			<!-- <property name="params" value="pageNum=start;pageSize=limit;"/> -->
			<!-- 支持通过Mapper接口参数来传递分页参数 -->
			<property name="supportMethodsArguments" value="true" />
			<!-- always总是返回PageInfo类型,check检查返回类型是否为PageInfo,none返回Page -->
			<property name="returnPageInfo" value="check" />
		</plugin>
	</plugins>
</configuration> 




applicationContext-mybatis.xml <!-- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="typeAliasesPackage" value="cn.com.orchard.plateform.module" /> <property name="mapperLocations"> <list> <value>classpath:cn/com/orchard/plateform/module/*/dao/*Mapper.xml </value> </list> </property> <property name="configLocation" value="classpath:mybatis-setting.xml"></property> </bean>
启动报错信息如下
WARN 2017-12-18 16:52:48 localhost-startStop-1 [AbstractBeanFactory.java-1524] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ipSectionBeanMapper' defined in file [D:\developer\tools\server\apache-tomcat-8.0.47-windows-x64\apache-tomcat-8.0.47\conf\wtpwebapps\Orchard\WEB-INF\classes\cn\com\orchard\plateform\module\website\dao\IpSectionBeanMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-mybatis.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.github.pagehelper.parser.impl.AbstractParser
WARN 2017-12-18 16:52:48 localhost-startStop-1 [AbstractBeanFactory.java-1524] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSiteBeanMapper' defined in file [D:\developer\tools\server\apache-tomcat-8.0.47-windows-x64\apache-tomcat-8.0.47\conf\wtpwebapps\Orchard\WEB-INF\classes\cn\com\orchard\plateform\module\website\dao\WebSiteBeanMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-mybatis.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.github.pagehelper.parser.impl.AbstractParser
WARN 2017-12-18 16:52:48 localhost-startStop-1 [AbstractBeanFactory.java-1524] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysParamBeanMapper' defined in file [D:\developer\tools\server\apache-tomcat-8.0.47-windows-x64\apache-tomcat-8.0.47\conf\wtpwebapps\Orchard\WEB-INF\classes\cn\com\orchard\plateform\module\sysconf\dao\SysParamBeanMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-mybatis.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.github.pagehelper.parser.impl.AbstractParser
WARN 2017-12-18 16:52:48 localhost-startStop-1 [AbstractBeanFactory.java-1524] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSiteBeanMapper' defined in file [D:\developer\tools\server\apache-tomcat-8.0.47-windows-x64\apache-tomcat-8.0.47\conf\wtpwebapps\Orchard\WEB-INF\classes\cn\com\orchard\plateform\module\website\dao\WebSiteBeanMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-mybatis.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.github.pagehelper.parser.impl.AbstractParser
3 回复

很明显, 没有加jar包

我已经加了呀,如果不加,会直接报错吧?

那现在是直接报错嘛...

添加回复
请先登陆
回到顶部