I have created a ConfigServer, Eureka Server and a rest Service(UserService) project.All are Spring-boot gradle based projects. ConfigServer, Eureka Server starts normally and works fine.

For UserService, When I create a gradle build and run the fat jar with command java -jar jarname.jar
the service get registered with the Eureka server and is displayed on the Eureka console.

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.

Compared the logs for start up in both cases, Following logs are missing when ran from eclipse against the running as fat jar. Why the service fails to registered when started from 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

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)```

1 Answers

0
John On Best Solutions

Ran the same code with STS and it worked. Seems some problem with eclipse Oxygen version. It also ran well in Eclipse latest 2018-12 version