报错信息:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.<clinit>(PaginationInnerInterceptor.java:70)
The following method did not exist:
net.sf.jsqlparser.schema.Column.withColumnName(Ljava/lang/String;)Lnet/sf/jsqlparser/schema/Column;
The method's class, net.sf.jsqlparser.schema.Column, is available from the following locations:
jar:file:/Users/tangcheng/.m2/repository/com/github/jsqlparser/jsqlparser/2.0/jsqlparser-2.0.jar!/net/sf/jsqlparser/schema/Column.class
The class hierarchy was loaded from the following locations:
net.sf.jsqlparser.schema.Column: file:/Users/tangcheng/.m2/repository/com/github/jsqlparser/jsqlparser/2.0/jsqlparser-2.0.jar
net.sf.jsqlparser.parser.ASTNodeAccessImpl: file:/Users/tangcheng/.m2/repository/com/github/jsqlparser/jsqlparser/2.0/jsqlparser-2.0.jar
解决办法:
exclude或去掉 低版本的 jsqlparser
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.13</version>
<exclusions>
<exclusion>
<artifactId>mybatis-spring</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
<exclusion>
<artifactId>mybatis-spring-boot-starter</artifactId>
<groupId>org.mybatis.spring.boot</groupId>
</exclusion>
<exclusion>
<artifactId>jsqlparser</artifactId>
<groupId>com.github.jsqlparser</groupId>
</exclusion>
</exclusions>
</dependency>
还有一种情况是缺少jsqlparser,此时,增加这个依赖即可
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>3.1</version>
</dependency>
原因:
在使用mybatis分页插件时,需要依赖 jsqlparser。
这个错误表示分页插件版本与依赖版本不匹配。建议多去尝试,高配高,低配低。
网友评论