java - 没有注册的 Eureka 客户端实例。(JAVA11,Maven)
问题描述
我正在使用 Java 11 和 Maven 开发 Spring Cloud 项目。
我尝试使用 Eureka Server 注册 Eureka 客户端服务。但是 Eureka 仪表板上没有显示注册服务。
我也曾尝试在互联网上搜索解决方案,包括 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>
这是我的尤里卡项目的属性,
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);
}
}
解决方案
我已经更改了版本,它已经开始为我工作了。
<spring-cloud.version>2020.0.3</spring-cloud.version>
推荐阅读
- cryptography - 区块链数据是永久存储的吗?
- php - PHP 未捕获错误:在 null 上调用成员函数 escape_value()
- javascript - 在 nodejs 中观察会话创建-销毁事件
- excel - 将变量设置为超链接中包含的范围
- python - 为什么我不能在 Python lambda 中使用元组打包?
- java - java.lang.ClassNotFoundException:io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
- pandas - 条件合并 Pandas
- mule - Dataweave 2 如何将对象映射到对象的 JSON 数组
- javascript - 在 json 中获取对象的问题。Javascript
- java - 是否存在手动抛出错误的用例?