没有已注册的Eureka客户端实例。 (JAVA11,Maven)

时间:2020-09-29 11:04:12

标签: java spring maven netflix-eureka

我正在使用Java 11和Maven进行Spring Cloud项目。

我已经尝试在Eureka服务器上注册Eureka客户端服务。但是Eureka仪表板上没有显示注册的服务。

我已经尝试过在Internet上搜索解决方案,包括Stackoverflow,但是没有运气。

 ()

这是我在 Eureka 项目中的pom.xml的依赖项,

<properties>
    <java.version>11</java.version>
    <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
</properties>

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

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

这是我的 Eureka 项目的属性,

    server.port=8761
    spring.application.name=eureka-server

    eureka.instance.hostname=localhost
    eureka.client.register-with-eureka=false
    eureka.client.fetch-registry=false
    eureka.client.service-url.defaultZone=http://localhost:8761/eureka/
    eureka.server.enableSelfPreservation=true

    logging.level.com.netflix.eureka=OFF
    logging.level.com.netflix.discovery=OFF

    message=Eureka hello

这是我的客户端服务( auth-server )的属性之一,

server.port=8001
spring.application.name=auth-server

#Eureka
eureka.instance.hostname=localhost
eureka.instance.preferIpAddress=true
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true
eureka.client.service-url.defaultZone=http://localhost:8761/eureka/
management.security.enabled=false

与AuthServerApplication.java文件一起

@EnableDiscoveryClient
@SpringBootApplication
public class AuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthServerApplication.class, args);
    }

}

1 个答案:

答案 0 :(得分:-1)

我已经更改了版本,它已经开始为我工作了。

2020.0.3