1
votes

I am trying to access the /get API or endpoint as defined in application.yml but I am getting 404 not found

GET /get HTTP/1.1 Accept: / Accept-Encoding: gzip, deflate Connection: keep-alive Host: localhost:8761 User-Agent: HTTPie/0.9.9

HTTP/1.1 404 Content-Type: application/json;charset=UTF-8 Date: Tue, 23 Jan 2018 10:39:07 GMT Transfer-Encoding: chunked

{ "error": "Not Found", "message": "No message available", "path": "/get", "status": 404, "timestamp": "2018-01-23T10:39:07.770+0000" }

Here is my setup

Maven pom dependencies Finchley.M5

org.springframework.cloud:spring-boot-starter-actuator

org.springframework.cloud:spring-cloud-starter-netflix-eureka-server

org.springframework.cloud:spring-cloud-starter-gateway

org.springframework.cloud:spring-boot-starter-webflux

application.yml

spring:
  application:
    name: gateway
  cloud:
    gateway:
      routes:
      - id: get
        uri: http://httpbin.org:80
        predicates:
        - Path=/get
server:
  port: 8761
eureka:
  client:
    fetch-registry: false
    register-with-eureka: false

Application.java

@SpringBootApplication
@EnableEurekaServer
public class GatewayApplication {

@Bean
public DiscoveryClientRouteDefinitionLocator clientRouteDefinitionLocator(DiscoveryClient discoveryClient) {
    return new DiscoveryClientRouteDefinitionLocator(discoveryClient);
}

public static void main(String[] args) {
    SpringApplication.run(GatewayApplication.class, args);
}
}

Error Stack Trace

2018-01-23 15:33:14.687 INFO 14372 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6913c1fb: startup date [Tue Jan 23 15:33:14 IST 2018]; root of context hierarchy 2018-01-23 15:33:14.903 INFO 14372 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2018-01-23 15:33:14.935 INFO 14372 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b9f413f5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-01-23 15:33:15.120 INFO 14372 --- [ main] o.h.v.i.engine.ValidatorFactoryImpl : HV000238: Temporal validation tolerance set to 0.

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

2018-01-23 15:33:16.591 INFO 14372 --- [ main] com.example.gateway.GatewayApplication : No active profile set, falling back to default profiles: default 2018-01-23 15:33:16.606 INFO 14372 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@339bf286: startup date [Tue Jan 23 15:33:16 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@6913c1fb 2018-01-23 15:33:17.191 INFO 14372 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'environmentWebEndpointExtension' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration; factoryMethodName=environmentWebEndpointExtension; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.autoconfigure.LifecycleMvcEndpointAutoConfiguration; factoryMethodName=environmentWebEndpointExtension; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration.class]] 2018-01-23 15:33:17.360 INFO 14372 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=16d8c42e-7df4-3c80-b5a1-d892788f2f66 2018-01-23 15:33:17.376 INFO 14372 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2018-01-23 15:33:17.422 INFO 14372 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b9f413f5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-01-23 15:33:17.476 INFO 14372 --- [ main] o.h.v.i.engine.ValidatorFactoryImpl : HV000238: Temporal validation tolerance set to 0. 2018-01-23 15:33:17.639 INFO 14372 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8761 (http) 2018-01-23 15:33:17.639 INFO 14372 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-01-23 15:33:17.639 INFO 14372 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23 2018-01-23 15:33:17.657 INFO 14372 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_111\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files\Microsoft MPI\Bin\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_111\bin;C:\ncrdev\tools\apache-maven-3.3.9\bin;C:\Program Files\erl8.2\bin;C:\Users\sk185439\Downloads\rabbitmq_server-3.6.6\sbin;C:\Users\sk185439\Downloads\apache-ant-1.9.7\bin;C:\Qt\Qt5.7.1\5.7\msvc2013_64\bin;C:\Python27;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files (x86)\MSBuild\12.0\Bin;C:\Program Files (x86)\Subversion\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\PostgreSQL\9.1\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\NCR\AMS\bin;C:\Program Files\1E\NomadBranch\;C:\Program Files (x86)\Sennheiser\SoftphoneSDK\;C:\opscode\chefdk\bin\;C:\Program Files\Microsoft SQL Server Migration Assistant for Oracle\bin\;C:\Users\sk185439\Downloads\instantclient-basic-windows.x64-12.2.0.1.0\instantclient_12_2;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\PostgreSQL\pg10\bin;C:\Program Files\dotnet\;C:\Python27\Scripts;C:\Users\sk185439\AppData\Local\atom\bin;C:\Users\sk185439\AppData\Local\Microsoft\WindowsApps;C:\Users\sk185439\AppData\Local\GitHubDesktop\bin;C:\Users\sk185439\AppData\Local\Programs\Fiddler;.] 2018-01-23 15:33:17.761 INFO 14372 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-01-23 15:33:17.761 INFO 14372 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1155 ms 2018-01-23 15:33:18.239 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-01-23 15:33:18.239 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routes/{id}],methods=[DELETE]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.delete(java.lang.String) 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routes/{id}],methods=[POST]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.save(java.lang.String,reactor.core.publisher.Mono) 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/refresh],methods=[POST]}" onto public reactor.core.publisher.Mono org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.refresh() 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routes/{id}],methods=[GET]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.route(java.lang.String) 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routes],methods=[GET]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.routes() 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/globalfilters],methods=[GET]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.globalfilters() 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routes/{id}/combinedfilters],methods=[GET]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.combinedfilters(java.lang.String) 2018-01-23 15:33:18.262 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/gateway/routefilters],methods=[GET]}" onto public reactor.core.publisher.Mono> org.springframework.cloud.gateway.actuate.GatewayWebfluxEndpoint.routefilers() 2018-01-23 15:33:18.293 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.status(javax.servlet.http.HttpServletRequest,java.util.Map) 2018-01-23 15:33:18.293 INFO 14372 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/lastn],methods=[GET]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.lastn(javax.servlet.http.HttpServletRequest,java.util.Map) 2018-01-23 15:33:18.324 INFO 14372 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-23 15:33:18.324 INFO 14372 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-23 15:33:18.340 INFO 14372 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-23 15:33:19.815 INFO 14372 --- [ost-startStop-1] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2018-01-23 15:33:21.164 INFO 14372 --- [ost-startStop-1] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2018-01-23 15:33:21.471 INFO 14372 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map) 2018-01-23 15:33:21.471 INFO 14372 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map) 2018-01-23 15:33:21.471 INFO 14372 --- [ost-startStop-1] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto private java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest) 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMetricsFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestTraceFilter' to: [/] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'servletContainer' to urls: [/eureka/*] 2018-01-23 15:33:21.502 INFO 14372 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2018-01-23 15:33:21.549 INFO 14372 --- [ost-startStop-1] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM' 2018-01-23 15:33:21.602 INFO 14372 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson 2018-01-23 15:33:21.602 INFO 14372 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson 2018-01-23 15:33:21.649 INFO 14372 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml 2018-01-23 15:33:21.649 INFO 14372 --- [ost-startStop-1] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml 2018-01-23 15:33:21.949 WARN 14372 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2018-01-23 15:33:21.949 INFO 14372 --- [ 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. 2018-01-23 15:33:21.967 WARN 14372 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2018-01-23 15:33:21.967 INFO 14372 --- [ 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. 2018-01-23 15:33:21.987 INFO 14372 --- [ main] o.h.v.i.engine.ValidatorFactoryImpl : HV000238: Temporal validation tolerance set to 0. 2018-01-23 15:33:22.071 INFO 14372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@339bf286: startup date [Tue Jan 23 15:33:16 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@6913c1fb 2018-01-23 15:33:22.187 WARN 14372 --- [ main] GatewayClassPathWarningAutoConfiguration :


Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.


2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [After] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Before] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Between] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Cookie] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Header] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Host] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Method] 2018-01-23 15:33:22.819 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Path] 2018-01-23 15:33:22.834 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Query] 2018-01-23 15:33:22.834 INFO 14372 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [RemoteAddr] 2018-01-23 15:33:22.871 INFO 14372 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2018-01-23 15:33:22.888 INFO 14372 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2018-01-23 15:33:22.888 INFO 14372 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data. 2018-01-23 15:33:22.888 INFO 14372 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1516701802888 with initial instances count: 0 2018-01-23 15:33:23.119 INFO 14372 --- [ main] o.s.ui.freemarker.SpringTemplateLoader : SpringTemplateLoader for FreeMarker: using resource loader [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@339bf286: startup date [Tue Jan 23 15:33:16 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@6913c1fb] and template loader path [classpath:/templates/] 2018-01-23 15:33:23.119 INFO 14372 --- [ main] o.s.w.s.v.f.FreeMarkerConfigurer : ClassTemplateLoader for Spring macros added to FreeMarker configuration 2018-01-23 15:33:23.273 INFO 14372 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ... 2018-01-23 15:33:23.273 WARN 14372 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : The replica size seems to be empty. Check the route 53 DNS Registry 2018-01-23 15:33:23.288 INFO 14372 --- [ main] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: [] 2018-01-23 15:33:23.288 INFO 14372 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initialized 2018-01-23 15:33:23.351 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-01-23 15:33:23.372 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'environmentManager' has been autodetected for JMX exposure 2018-01-23 15:33:23.373 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure 2018-01-23 15:33:23.373 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshScope' has been autodetected for JMX exposure 2018-01-23 15:33:23.373 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager] 2018-01-23 15:33:23.373 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope] 2018-01-23 15:33:23.388 INFO 14372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=339bf286,type=ConfigurationPropertiesRebinder] 2018-01-23 15:33:23.420 INFO 14372 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2018-01-23 15:33:23.420 INFO 14372 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application gateway with eureka with status UP 2018-01-23 15:33:23.420 INFO 14372 --- [ Thread-39] o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration.. 2018-01-23 15:33:23.420 INFO 14372 --- [ Thread-39] o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default 2018-01-23 15:33:23.420 INFO 14372 --- [ Thread-39] o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP 2018-01-23 15:33:23.435 INFO 14372 --- [ Thread-39] e.s.EurekaServerInitializerConfiguration : Started Eureka Server 2018-01-23 15:33:23.470 INFO 14372 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8761 (http) with context path '' 2018-01-23 15:33:23.470 INFO 14372 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761 2018-01-23 15:33:23.472 INFO 14372 --- [ main] com.example.gateway.GatewayApplication : Started GatewayApplication in 10.557 seconds (JVM running for 11.312) 2018-01-23 15:33:41.250 INFO 14372 --- [nio-8761-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet' 2018-01-23 15:33:41.250 INFO 14372 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2018-01-23 15:33:41.265 INFO 14372 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms

1
Can you please give more information? What are your dependencies of your gateway app? - spencergibb
Dependencies (Finchley.M5) ------------------- spring-boot-starter-actuator, spring-cloud-starter-netflix-eureka-server, spring-cloud-starter-gateway, spring-cloud-starter-netflix-hystrix, spring-boot-starter-data-redis-reactive, spring-boot-starter-webflux -------------------------- I have enabled eureka server and using DiscoveryClientRouteDefinitionLocator for load balancing for routing. - Shanthkumar khandre
Sample route ----------------- route(r -> r .path("/sample-service/**") .rewritePath("/sample-service/(?<remaining>.*)", "/${remaining}") .uri("lb://sample-service")) - Shanthkumar khandre
put them in the issue, not in comments please - spencergibb
@spencergibb I have added the additional information. I am not sure if I can use single application which will serve as Eureka Server as well as spring cloud gateway for routing purpose. Please let me know in case you need further information. - Shanthkumar khandre

1 Answers

1
votes

According to your stack trace, this seems to be Root Cause of Netflix Eureka not registered on the cloud gateway.

Initializing Eureka in region us-east-1 2018-01-23 15:33:22.888 INFO 14372 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data. 2018-01-23 15:33:22.888 INFO 14372 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1516701802888 with initial instances count: 0 2018-01-23 15:33:23.119 INFO 14372 --- [ main]

You should change some application properties in application.yml file:-

           eureka:
              client:
                fetch-registry: true
                register-with-eureka:false
                service-url:
                  defaultZone:htttp://eurekSever-xxx.com (eureka server url on the cloud)

In order for Client to either register or query for data ,you need to make one of fetch-registry or register-with eureka as true. You can make both as true. Let me explain what those fields mean here:

fetch-registry : true (This property allows Client application to fetch registered service on the eureka server by locating the eureka server through eureka.client.serviceurl.defaultZone). Discovery Client checks whether it can fetch registered services on the eureka server. If this property is false,it is not able to query for data)

register-with-eureka:true (Client application(App A) use this property if they want to be registered on the eureka server with particular instance which can later be fetched by another client application say App B).

discoveryClient.getInstances("client-application-name").get(0).getURI() should get the url of first Instance registered on netflix eureka