由于com.netflix.eventbus.spi.EventBus,Eureka Server Build失败

时间:2018-05-04 17:55:10

标签: spring-boot spring-cloud netflix-eureka

我正在尝试使用 spring boot 初始化创建一个spring cloud eureka服务器

但我得到以下例外。

  

java.lang.IllegalStateException:无法加载ApplicationContext引起:org.springframework.beans.factory.UnsatisfiedDependencyException:使用名称' org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration $ RefreshableEurekaClientConfiguration&#39创建bean时出错;:通过字段表示不满意的依赖性' optionalArgs&#39 ;;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为“discoverClientOptionalArgs'在类路径资源中定义[org / springframework / cloud / netflix / eureka / config /DiscoveryClientOptionalArgsConfiguration.class]:合并bean定义的后处理失败;嵌套异常是java.lang.IllegalStateException:无法从ClassLoader [sun.misc.Launcher$AppClassLoader@6bc7c054]内省Class [com.netflix.discovery.AbstractDiscoveryClientOptionalArgs]引起:org.springframework.beans.factory.BeanCreationException:创建错误bean名称为“discoveryClientOptionalArgs'在类路径资源中定义[org / springframework / cloud / netflix / eureka / config /DiscoveryClientOptionalArgsConfiguration.class]:合并bean定义的后处理失败;嵌套异常是java.lang.IllegalStateException:无法从ClassLoader [sun.misc.Launcher$AppClassLoader@6bc7c054]内省Class [com.netflix.discovery.AbstractDiscoveryClientOptionalArgs]引起:java.lang.IllegalStateException:无法内省Class [com来自ClassLoader的.netflix.discovery.AbstractDiscoveryClientOptionalArgs] [sun.misc.Launcher$AppClassLoader@6bc7c054]引起:java.lang.NoClassDefFoundError:com / netflix / eventbus / spi / EventBus引起:java.lang.ClassNotFoundException:com.netflix .eventbus.spi.EventBus

这是我的配置文件:

ymlfiles

server:
  port: 8761
eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false

这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.eureka.server</groupId>
    <artifactId>spring-eureka-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>spring-eureka-server</name>
    <description>Spring Eureka Server</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath/>
        <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RC1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>

        <!-- <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
        <version>1.1.5.RELEASE</version>
        </dependency> -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

1 个答案:

答案 0 :(得分:0)

我也遇到了这个错误(Spring Boot 2.0.3.RELEASE)。通过删除本地Maven存储库和mvn clean,mvn软件包,重新导入想法来解决此问题。怪异的问题。