【问题标题】:Could not start springboot-admin:java.lang.NoClassDefFoundError: org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration无法启动 springboot-admin:java.lang.NoClassDefFoundError: org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration
【发布时间】:2019-10-11 13:36:43
【问题描述】:

当我尝试启动 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

我要启动应用程序

【问题讨论】:

  • 我已经尝试过,但也失败了............
  • 为什么会有spring-cloud依赖?即使你需要,它也应该在dependencyManagement 标签下。
  • 哦,它在dependencyManagement下,我已经解决了...只需更改版本

标签: java spring-boot spring-cloud spring-batch-admin


【解决方案1】:

将你的 spring-cloud 依赖项移动到 dependencyManagement 标签下,然后尝试,

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.SR3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

【讨论】:

  • 谢谢,它在dependencyManagement标签下,我解决了,只需将springboot版本更改为1.5.5.RELEASE并将云版本更改为Edgware.SR5。
猜你喜欢
  • 2023-03-16
  • 1970-01-01
  • 2020-04-15
  • 2018-08-25
  • 1970-01-01
  • 2016-09-30
  • 1970-01-01
  • 2016-06-15
  • 2020-07-19
相关资源
最近更新 更多