无法启动 springboot-admin:java.lang.NoClassDefr:

当我尝试启动 springboot-admin 时,它抛出: java.lang.NoClassDefFoundError: org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration 这是我的版本冲突吗?


SpringBoot版本:2.1.9.RELEASE


SpringCloud版本:Greenwich.SR3


SpringBootAdmin版本:2.1.5


我的主类代码:


@Configuration

@EnableAutoConfiguration

@EnableAdminServer

@EnableDiscoveryClient

public class SpringbootAdminApplication {


    public static void main(String[] args) {

        SpringApplication.run(SpringbootAdminApplication.class, args);

    }


}

我的maven代码:


 <parent>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-parent</artifactId>

        <version>2.1.9.RELEASE</version>

        <relativePath/> <!-- lookup parent from repository -->

    </parent>

<!-- It's partly dependent-->

<dependency>

            <groupId>de.codecentric</groupId>

            <artifactId>spring-boot-admin-starter-server</artifactId>

            <version>2.1.5</version>

        </dependency>

 <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter</artifactId>

        </dependency>

 <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-web</artifactId>

        </dependency>

        <dependency>

            <groupId>org.springframework.cloud</groupId>

            <artifactId>spring-cloud-starter-eureka</artifactId>

        </dependency>

 <dependency>

                <groupId>org.springframework.cloud</groupId>

                <artifactId>spring-cloud-dependencies</artifactId>

                <version>Greenwich.SR3</version>

                <type>pom</type>

                <scope>import</scope>

            </dependency>

我的配置文件:


spring:

  application:

    name: spring-boot-admin

eureka:

  client:

    service-url:

      defaultZone: http://localhost:8010/eureka

server:

  port: 8083

我想启动应用程序


江户川乱折腾
浏览 90回答 1
1回答

弑天下

将 spring-cloud 依赖项移到 dependencyManagement 标签下,然后尝试,<dependencyManagement>&nbsp; &nbsp; &nbsp; &nbsp; <dependencies>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.cloud</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-cloud-dependencies</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>Greenwich.SR3</version>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <type>pom</type>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <scope>import</scope>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; </dependencies>&nbsp; &nbsp; </dependencyManagement>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java