Reputation: 31
application.properties:
spring.cloud.gateway.discovery.locator.enabled=true
logging.level.org.springframework.cloud.gateway=debug
spring.cloud.gateway.routes[0].uri=lb://BIZSERVICE-DEMO
spring.cloud.gateway.routes[0].predicates[0]=Path=/demo/**
spring.cloud.gateway.routes[0].filters[0].name=StripPrefix
spring.cloud.gateway.routes[0].filters[0].args.parts=1
spring.cloud.gateway.routes[0].filters[1].name=Hystrix
spring.cloud.gateway.routes[0].filters[1].args.name=fallbackcmd
spring.cloud.gateway.routes[0].filters[1].args.fallbackUri=forward:/fallback
hystrix.command.fallbackcmd.execution.isolation.thread.timeoutInMilliseconds=5000
When I run gateway service,visit http://.../demo/123,the console reports:
2018-08-02 14:50:49.454 [reactor-http-nio-2] ERROR ipf.filter.ExceptionHandler - {timestamp=Thu Aug 02 14:50:49 CST 2018, path=/demo/demo/1, status=500, error=Internal Server Error, message=Unable to find GatewayFilterFactory with name Hystrix, trace=java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name Hystrix at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.lambda$loadGatewayFilters$3(RouteDefinitionRouteLocator.java:142) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at
What is the cause of it, and what can I do to prevent it?
Upvotes: 1
Views: 4400
Reputation: 119
Maybe,you should use this dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
not this one
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
Upvotes: 2