spring cloud eureka 遇到的坑


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注册信息混乱。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM