zl程序教程

您现在的位置是:首页 >  工具

当前栏目

分页插件 错误信息com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor

GitHubApache插件 to Cannot 分页 be com
2023-09-14 09:14:50 时间

错误信息 :

com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor

解决方案 :

pom.xml :

    <!-- 分页助手 -->
    <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper</artifactId>
      <version>5.1.2</version>
    </dependency>

    <dependency>
      <groupId>com.github.jsqlparser</groupId>
      <artifactId>jsqlparser</artifactId>
      <version>1.0</version>
    </dependency>

在这里插入图片描述

sqlMapConfig.xml :

    <!-- 注意:分页助手的插件  配置在通用馆mapper之前 -->
    <!-- PageHelper5版本配置 -->
    <plugins>
        <plugin interceptor="com.github.pagehelper.PageInterceptor">
            <!-- 指定方言 -->
<!--            <property name="dialect" value="mysql"/>-->
        </plugin>
    </plugins>

在这里插入图片描述

错误信息 :

org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: mysql

在这里插入图片描述

解决方案 :

把方言注释
在这里插入图片描述