Eureka发现客户端无法启动
Eureka配置如下:
1、Eureka Server
spring:
application:
name: eureka-server
server:
port: 1001
eureka:
instance:
hostname: 127.0.0.1
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://localhost:${server.port}/eureka/
2、Eureka Discovery Client
spring:
application:
name: eureka-member-server
server:
port: 2001
eureka:
client:
service-url:
defaultZone: http://localhost:1001/eureka/
出现的问题
Eureka Server 端可以正常启动,而Eureka Discovery Client 端启动后立马停止,无法启动,控制台也没有报异常。
2019-11-14 00:20:03.171 INFO 7000 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$870d30e3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.10.RELEASE)
2019-11-14 00:20:03.416 INFO 7000 --- [ main] c.a.c.m.MemberServerApplication : No active profile set, falling back to default profiles: default
2019-11-14 00:20:03.597 INFO 7000 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=153cdf16-24c6-3442-8fc6-ec2719596d9e
2019-11-14 00:20:03.627 INFO 7000 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$870d30e3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-11-14 00:20:03.636 WARN 7000 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-11-14 00:20:03.636 INFO 7000 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-11-14 00:20:03.638 WARN 7000 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-11-14 00:20:03.638 INFO 7000 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-11-14 00:20:04.095 INFO 7000 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-11-14 00:20:04.113 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-11-14 00:20:04.266 INFO 7000 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-11-14 00:20:04.267 INFO 7000 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/F:/Files/maven_repository/com/thoughtworks/xstream/xstream/1.4.11.1/xstream-1.4.11.1.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-11-14 00:20:04.346 INFO 7000 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-11-14 00:20:04.346 INFO 7000 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-11-14 00:20:04.430 INFO 7000 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-11-14 00:20:04.536 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-11-14 00:20:04.537 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-11-14 00:20:04.615 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-11-14 00:20:04.616 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-11-14 00:20:04.617 INFO 7000 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-11-14 00:20:04.623 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1573662004623 with initial instances count: 1
2019-11-14 00:20:04.624 INFO 7000 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application EUREKA-MEMBER-SERVER with eureka with status UP
2019-11-14 00:20:04.624 INFO 7000 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1573662004624, current=UP, previous=STARTING]
2019-11-14 00:20:04.625 INFO 7000 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-MEMBER-SERVER/DESKTOP-HP5SJVV:eureka-member-server:2001: registering service...
2019-11-14 00:20:04.632 INFO 7000 --- [ main] c.a.c.m.MemberServerApplication : Started MemberServerApplication in 1.972 seconds (JVM running for 2.426)
2019-11-14 00:20:04.634 INFO 7000 --- [ Thread-4] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application EUREKA-MEMBER-SERVER with eureka with status DOWN
2019-11-14 00:20:04.634 WARN 7000 --- [ Thread-4] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1573662004634, current=DOWN, previous=UP]
2019-11-14 00:20:04.639 INFO 7000 --- [ Thread-4] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-11-14 00:20:04.646 INFO 7000 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-MEMBER-SERVER/DESKTOP-HP5SJVV:eureka-member-server:2001 - registration status: 204
2019-11-14 00:20:04.647 INFO 7000 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-MEMBER-SERVER/DESKTOP-HP5SJVV:eureka-member-server:2001: registering service...
2019-11-14 00:20:04.650 INFO 7000 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-MEMBER-SERVER/DESKTOP-HP5SJVV:eureka-member-server:2001 - registration status: 204
2019-11-14 00:20:04.650 INFO 7000 --- [ Thread-4] com.netflix.discovery.DiscoveryClient : Unregistering ...
2019-11-14 00:20:04.654 INFO 7000 --- [ Thread-4] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-MEMBER-SERVER/DESKTOP-HP5SJVV:eureka-member-server:2001 - deregister status: 200
2019-11-14 00:20:04.661 INFO 7000 --- [ Thread-4] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
Process finished with exit code 0
解决方法
给Eureka Discovery Client 端添加web模块的起始依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>