最近在尝试微服务架构下的activiti搭建。结果启动遇到了如下问题。
***************************
APPLICATION FAILED TO START
***************************
Description:
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:/Users/qindp/.m2/repository/com/baomidou/mybatis-plus-core/3.3.2/mybatis-plus-core-3.3.2.jar!/com/baomidou/mybatisplus/core/MybatisConfiguration.class
The class hierarchy was loaded from the following locations:
com.baomidou.mybatisplus.core.MybatisConfiguration: file:/C:/Users/qindp/.m2/repository/com/baomidou/mybatis-plus-core/3.3.2/mybatis-plus-core-3.3.2.jar
org.apache.ibatis.session.Configuration: file:/C:/Users/qindp/.m2/repository/org/mybatis/mybatis/3.4.2/mybatis-3.4.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.mybatisplus.core.MybatisConfiguration
看起来是mybatis-plus的jar包冲突了,我最开始以为是和springboot冲突,后来怀疑是与nacos冲突,尝试换版本,排除依赖等方式,找了好久都没解决。
偶然翻到一个博主关于activiti的配置,才想到可能是与activiti冲突。试了一下果然如此。修改如下,在pom的activiti包中移除mybatis。
<!--activiti基础包-->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
<exclusions>
<exclusion><!-- 排除activiti的mybatis,避免和外面的mybatis-plus冲突 -->
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
问题解决了,但是之前没有用微服务时,我用mybatis-plus:3.3.0和activiti:6.0.0都没有出错,同样版本用了微服务就出错了,原因不明,不止各位大佬有否知道的。