[英]Eclipse : service not getting registered with eureka server When started from eclipse
I have created a ConfigServer, Eureka Server and a rest Service(UserService) project.All are Spring-boot gradle based projects. 我创建了一个ConfigServer,Eureka Server和一个rest Service(UserService)项目。所有这些都是基于Spring-boot gradle的项目。 ConfigServer, Eureka Server starts normally and works fine.
ConfigServer,Eureka Server正常启动并正常运行。
For UserService, When I create a gradle build and run the fat jar with command java -jar jarname.jar
对于UserService,当我创建一个gradle构建并使用命令
java -jar jarname.jar
运行fat jar时
the service get registered with the Eureka server and is displayed on the Eureka console. 该服务在Eureka服务器上注册并显示在Eureka控制台上。
But When I run the same UserService project from eclipse as a java Application selecting the main class, it starts up but never gets registered with the Eureka server. 但是当我从eclipse运行相同的UserService项目作为选择主类的java应用程序时,它启动但从未在Eureka服务器上注册。
Compared the logs for start up in both cases, Following logs are missing when ran from eclipse against the running as fat jar. 比较两种情况下的启动日志,当从eclipse运行作为胖罐运行时,缺少以下日志。 Why the service fails to registered when started from eclipse?
从eclipse启动时为什么服务无法注册? Any suggestions will be welcome.
欢迎任何建议。
Starting beans in phase 0
2019-05-07 12:26:02.858 INFO [user-service,,,] 21568 ---
2019-05-07 12:26:02.639 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering beans for JMX exposure on startup
2019-05-07 12:26:02.640 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
2019-05-07 12:26:02.644 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
2019-05-07 12:26:02.709 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
2019-05-07 12:26:02.712 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
2019-05-07 12:26:02.726 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
2019-05-07 12:26:02.728 INFO [user-service,,,] 21568 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
2019-05-07 12:26:02.767 INFO [user-service,,,] 21568 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2019-05-07 12:26:02.858 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-05-07 12:26:03.164 INFO [user-service,,,] 21568 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-05-07 12:26:03.164 INFO [user-service,,,] 21568 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-05-07 12:26:03.332 INFO [user-service,,,] 21568 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-05-07 12:26:03.332 INFO [user-service,,,] 21568 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-05-07 12:26:03.607 INFO [user-service,,,] 21568 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-05-07 12:26:03.651 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2019-05-07 12:26:03.666 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2019-05-07 12:26:03.847 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2019-05-07 12:26:03.849 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2019-05-07 12:26:03.851 INFO [user-service,,,] 21568 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-05-07 12:26:03.855 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1557212163854 with initial instances count: 4
2019-05-07 12:26:03.864 INFO [user-service,,,] 21568 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1557212163864, current=UP, previous=STARTING]
Logs from eclipse console while start-up where service starts without service registration 在没有服务注册的情况下启动服务的启动时从eclipse控制台进行日志记录
2019-05-08 17:36:29.088 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
2019-05-08 17:36:29.092 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
2019-05-08 17:36:29.098 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
2019-05-08 17:36:29.101 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
2019-05-08 17:36:29.142 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
2019-05-08 17:36:29.144 INFO [user-service,,,] 21184 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
2019-05-08 17:36:29.172 INFO [user-service,,,] 21184 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2019-05-08 17:36:29.172 INFO [user-service,,,] 21184 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2019-05-08 17:36:29.172 INFO [user-service,,,] 21184 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'user-service-1.errorChannel' has 1 subscriber(s).
2019-05-08 17:36:29.172 INFO [user-service,,,] 21184 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2019-05-08 17:36:29.172 INFO [user-service,,,] 21184 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2019-05-08 17:36:29.230 INFO [user-service,,,] 21184 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8084 (http) with context path ''
2019-05-08 17:36:29.233 INFO [user-service,,,] 21184 --- [ main] io.pivotal.user.UserApplication : Started UserApplication in 16.091 seconds (JVM running for 17.037)```
Ran the same code with STS and it worked. 与STS保持相同的代码并且它有效。 Seems some problem with eclipse Oxygen version.
看来eclipse氧气版有些问题。 It also ran well in Eclipse latest 2018-12 version
它在Eclipse最新的2018-12版本中运行良好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.