elastic-job和spring cloud版本冲突2

  • 投稿人: anan
  • 发布时间: 2021-07-07 10:49:44
  • 阅读: 287
  • 收藏: 16
  • 点赞: 1
  • 评论: 0

***************************
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:

org.apache.curator.framework.listen.ListenerContainer.addListener(ListenerContainer.java:41)

The following method did not exist:

com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;

The method's class, com.google.common.util.concurrent.MoreExecutors, is available from the following locations:

jar:file:/J:/program/myprogram/maven/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar!/com/google/common/util/concurrent/MoreExecutors.class

It was loaded from the following location:

file:/J:/program/myprogram/maven/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.common.util.concurrent.MoreExecutors

Disconnected from the target VM, address: '127.0.0.1:1109', transport: 'socket'

Process finished with exit code 1

 

解决办法

把 com.google.guava 版本降低到20.0以下就可以了

我引用的版本是

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <elastic-job.version>2.1.5</elastic-job.version>
        <curator.version>2.10.0</curator.version>
    </properties>




<!-- 任务调度elastic-job开始 -->
        <dependency>
            <groupId>com.dangdang</groupId>
            <artifactId>elastic-job-lite-core</artifactId>
            <version>${elastic-job.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>curator-client</artifactId>
                    <groupId>org.apache.curator</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>curator-framework</artifactId>
                    <groupId>org.apache.curator</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>curator-recipes</artifactId>
                    <groupId>org.apache.curator</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-client</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>20.0</version>
        </dependency>
        <!-- 任务调度elastic-job结束 -->



  <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Hoxton.SR3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.2.1.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <!-- 编译插件 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>