当前位置: 代码迷 >> 综合 >> mybatisplus:An attempt was made to call a method that does not exist
  详细解决方案

mybatisplus:An attempt was made to call a method that does not exist

热度:29   发布时间:2023-10-26 16:44:56.0

异常名称

An attempt was made to call a method that does not exist. The attempt was made from the following location:com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.getLanguageDriver(MybatisMapperAnnotationBuilder.java:371)The following method did not exist:com.baomidou.mybatisplus.core.MybatisConfiguration.getLanguageDriver(Ljava/lang/Class;)Lorg/apache/ibatis/scripting/LanguageDriver;The method's class, com.baomidou.mybatisplus.core.MybatisConfiguration, is available from the following locations:jar:file:/C:/maven/repository/com/baomidou/mybatis-plus-core/3.3.2/mybatis-plus-core-3.3.2.jar!/com/baomidou/mybatisplus/core/MybatisConfiguration.classIt was loaded from the following location:file:/C:/maven/repository/com/baomidou/mybatis-plus-core/3.3.2/mybatis-plus-core-3.3.2.jarAction:Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.mybatisplus.core.MybatisConfiguration

原因分析

mybatisplus 包依赖冲突导致,大家可以展开mybatis的包依赖,可以看到mybatis依赖显示冲突,mybatisplus依赖的是3.5.2,但是被一个3.4.2的版本冲突了(idea编辑器界面如下)
在这里插入图片描述
进行依赖分析找到产生此依赖的包,使用idea分析如下 mybatis----》activiti-engine----》activiti-spring-boot-starter(项目中引入的)
在这里插入图片描述
最终可以确定是由于我在项目中引入了activiti-spring-boot-starter,activiti-spring-boot-starter中引入了mybatis3.4.2,导致产生mybatis依赖包冲突,mybatis-plus使用了低版本的mybatis,导致method that does not exist。
解决办法:排除activiti-spring-boot-starter中的mybatis,使用mybatisplus中高版本的mybatis,重新编译工程(一般使用高版本的mybatis,除非版本不兼容,再想办法)。

<dependency><groupId>org.activiti</groupId><artifactId>activiti-spring-boot-starter</artifactId><version>7.1.0.M4</version><exclusions><exclusion><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId></exclusion></exclusions>
</dependency>
  相关解决方案