Friday, May 15, 2020

Gradle: error running Eureka server Returning 404 error

I am trying to run eureka server project via eclipse. It's one of the simplest , but trickiest ..

What i did.

1. Create Spring boot Eireka server with spring http://start.spring.io/
2. Added annotations and property files as needed

@EnableEurekaServer  for main class

and for application.yml

eureka:
   instance:
      hostname: localhost
   client: # Not a client, don't register with yourself
      registerWithEureka: false
      fetchRegistry: false
server:
   port: 1111 # HTTP (Tomcat) port

3. Run main class as Java aplication. Eclipse --> Run As --> Java Application
4. No errors in the console
5. hence i used port=1111
try with http://localhost:1111/

6. Getting 404 error



Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri May 15 21:22:02 IST 2020
There was an unexpected error (type=Not Found, status=404).
No message available

7. Below attached the output in Eclipse console. Eclispe console output-1

8. Eureka server is up and running in port 1111. But in browser localhost:1111 --> Navigates to 404 error page

9. Let's try with gradle command line manually. Stop eclipse run.
10.  build the project and run

gradle buiild  --> Build succesful
gradle bootRun

11. Eureka server start up and running in port 1111
12. attached log in output-2








7. Eclipse console output-1
---------------------------------------

2020-05-15 21:24:45.865  INFO 19320 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.7.RELEASE)

2020-05-15 21:24:46.973  INFO 19320 --- [  restartedMain] c.e.r.RegisterServerApplication          : No active profile set, falling back to default profiles: default
2020-05-15 21:24:48.782  WARN 19320 --- [  restartedMain] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-05-15 21:24:49.075  INFO 19320 --- [  restartedMain] o.s.cloud.context.scope.GenericScope     : BeanFactory id=6b8184a9-51b7-31fa-8e18-4982d979a052
2020-05-15 21:24:50.717  INFO 19320 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 1111 (http)
2020-05-15 21:24:50.739  INFO 19320 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-05-15 21:24:50.740  INFO 19320 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.34]
2020-05-15 21:24:51.090  INFO 19320 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-05-15 21:24:51.091  INFO 19320 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4092 ms
2020-05-15 21:24:51.215  WARN 19320 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-15 21:24:51.215  INFO 19320 --- [  restartedMain] 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.
2020-05-15 21:24:51.245  INFO 19320 --- [  restartedMain] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@379c1d6
2020-05-15 21:24:52.708  INFO 19320 --- [  restartedMain] c.s.j.s.i.a.WebApplicationImpl           : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2020-05-15 21:24:52.826  INFO 19320 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-05-15 21:24:52.828  INFO 19320 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-05-15 21:24:53.403  INFO 19320 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-05-15 21:24:53.404  INFO 19320 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2020-05-15 21:24:54.445  WARN 19320 --- [  restartedMain] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2020-05-15 21:24:54.447  WARN 19320 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-15 21:24:54.448  INFO 19320 --- [  restartedMain] 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.
2020-05-15 21:24:55.235  INFO 19320 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-15 21:24:55.865  INFO 19320 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-05-15 21:24:56.516  WARN 19320 --- [  restartedMain] ockingLoadBalancerClientRibbonWarnLogger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
2020-05-15 21:24:56.593  INFO 19320 --- [  restartedMain] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2020-05-15 21:24:56.658  INFO 19320 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2020-05-15 21:24:56.658  INFO 19320 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2020-05-15 21:24:56.680  INFO 19320 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1589558096678 with initial instances count: 0
2020-05-15 21:24:56.800  INFO 19320 --- [  restartedMain] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2020-05-15 21:24:56.804  WARN 19320 --- [  restartedMain] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry
2020-05-15 21:24:56.912  INFO 19320 --- [  restartedMain] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2020-05-15 21:24:56.913  INFO 19320 --- [  restartedMain] c.n.eureka.DefaultEurekaServerContext    : Initialized
2020-05-15 21:24:56.934  INFO 19320 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-05-15 21:24:56.985  INFO 19320 --- [  restartedMain] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2020-05-15 21:24:57.022  INFO 19320 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2020-05-15 21:24:57.025  INFO 19320 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2020-05-15 21:24:57.026  INFO 19320 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2020-05-15 21:24:57.074  INFO 19320 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2020-05-15 21:24:57.077  INFO 19320 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2020-05-15 21:24:57.080  INFO 19320 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2020-05-15 21:24:57.081  INFO 19320 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2020-05-15 21:24:57.081  INFO 19320 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2020-05-15 21:24:57.119  INFO 19320 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 1111 (http) with context path ''
2020-05-15 21:24:57.119  INFO 19320 --- [  restartedMain] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 1111
2020-05-15 21:24:57.137  INFO 19320 --- [      Thread-17] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2020-05-15 21:24:57.857  INFO 19320 --- [  restartedMain] c.e.r.RegisterServerApplication          : Started RegisterServerApplication in 13.609 seconds (JVM running for 14.866)
2020-05-15 21:25:57.104  INFO 19320 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2020-05-15 21:26:57.118  INFO 19320 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 13ms
2020-05-15 21:27:57.118  INFO 19320 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2020-05-15 21:28:57.118  INFO 19320 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2020-05-15 21:29:57.119  INFO 19320 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms




12. output-2    gradle bootRun output
----------------------------------------------------------------


> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE

> Task :bootRun
2020-05-15 21:38:16.878  INFO 17600 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.7.RELEASE)

2020-05-15 21:38:18.083  INFO 17600 --- [  restartedMain] c.e.r.RegisterServerApplication          : No active profile set, falling back to default profiles: default
2020-05-15 21:38:19.459  WARN 17600 --- [  restartedMain] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-05-15 21:38:19.646  INFO 17600 --- [  restartedMain] o.s.cloud.context.scope.GenericScope     : BeanFactory id=d20a0ae6-0dc1-3853-b713-090cd5293043
2020-05-15 21:38:21.304  INFO 17600 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 1111 (http)
2020-05-15 21:38:21.326  INFO 17600 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-05-15 21:38:21.326  INFO 17600 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.34]
2020-05-15 21:38:21.687  INFO 17600 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-05-15 21:38:21.687  INFO 17600 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3571 ms
2020-05-15 21:38:21.822  WARN 17600 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-15 21:38:21.822  INFO 17600 --- [  restartedMain] 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.
2020-05-15 21:38:21.841  INFO 17600 --- [  restartedMain] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@689add69
2020-05-15 21:38:23.534  INFO 17600 --- [  restartedMain] c.s.j.s.i.a.WebApplicationImpl           : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2020-05-15 21:38:23.785  INFO 17600 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-05-15 21:38:23.788  INFO 17600 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-05-15 21:38:24.206  INFO 17600 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-05-15 21:38:24.206  INFO 17600 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2020-05-15 21:38:24.848  WARN 17600 --- [  restartedMain] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2020-05-15 21:38:24.849  WARN 17600 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-15 21:38:24.850  INFO 17600 --- [  restartedMain] 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.
2020-05-15 21:38:25.108  INFO 17600 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-15 21:38:25.698  INFO 17600 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-05-15 21:38:26.601  WARN 17600 --- [  restartedMain] ockingLoadBalancerClientRibbonWarnLogger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
2020-05-15 21:38:26.709  INFO 17600 --- [  restartedMain] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2020-05-15 21:38:26.773  INFO 17600 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2020-05-15 21:38:26.774  INFO 17600 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2020-05-15 21:38:26.788  INFO 17600 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1589558906785 with initial instances count: 0
2020-05-15 21:38:26.873  INFO 17600 --- [  restartedMain] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2020-05-15 21:38:26.879  WARN 17600 --- [  restartedMain] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry
2020-05-15 21:38:26.985  INFO 17600 --- [  restartedMain] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2020-05-15 21:38:26.987  INFO 17600 --- [  restartedMain] c.n.eureka.DefaultEurekaServerContext    : Initialized
2020-05-15 21:38:27.012  INFO 17600 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-05-15 21:38:27.053  INFO 17600 --- [  restartedMain] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2020-05-15 21:38:27.058  INFO 17600 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2020-05-15 21:38:27.058  INFO 17600 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2020-05-15 21:38:27.060  INFO 17600 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2020-05-15 21:38:27.094  INFO 17600 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2020-05-15 21:38:27.095  INFO 17600 --- [      Thread-17] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2020-05-15 21:38:27.095  INFO 17600 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2020-05-15 21:38:27.096  INFO 17600 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2020-05-15 21:38:27.096  INFO 17600 --- [      Thread-17] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2020-05-15 21:38:27.121  INFO 17600 --- [      Thread-17] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2020-05-15 21:38:27.140  INFO 17600 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 1111 (http) with context path ''
2020-05-15 21:38:27.141  INFO 17600 --- [  restartedMain] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 1111
2020-05-15 21:38:27.913  INFO 17600 --- [  restartedMain] c.e.r.RegisterServerApplication          : Started RegisterServerApplication in 12.488 seconds (JVM running for 13.927)

1 comment: