1.eureka.client.serviceUrl.defaultZone 中defaultZone不等于default-zone
使用default-zone eureka客户端会识别不了,会向localhost:8761注册,造成服务发现混乱。
2. eureka 客户端 传递依赖(间接依赖) javaee-api-8.0 与 eureka传递依赖jsr311-api-1.1.1.jar 下javax.ws.rs 相关类冲突
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception;
Caused by: java.lang.RuntimeException: Failed to initialize DiscoveryClient!
Caused by: java.lang.ExceptionInInitializerError: null
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl
2018-11-28 21:37:36.197 ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException
解决:项目中pom中引入javaee-api “短路优先” 覆盖传递依赖。
3.使用IP进行配置eurake 但是没有eureka.instance.prefer-ip-address=true时,集群erueka注册信息混乱。
本文详细解析了SpringCloud Eureka在实际应用中遇到的常见问题,包括配置错误导致的服务发现混乱、依赖冲突引发的运行时异常以及IP配置不当引起的注册信息混乱。针对这些问题,文章提供了具体的解决策略,如正确配置defaultZone、调整依赖关系和明确IP地址设置。

2624

被折叠的 条评论
为什么被折叠?



