当前位置:网站首页>The gateway starts other microservices first. When the gateway is started, the gateway cannot be started and there is no exception log; Start the gateway first, and all services can be started normall

The gateway starts other microservices first. When the gateway is started, the gateway cannot be started and there is no exception log; Start the gateway first, and all services can be started normall

2022-06-11 21:04:00 qq_ twenty-one million four hundred and eighty thousand three h

upgrade spring boot To 2.7.0,gateway Start other microservices first , Starting the gateway , The gateway cannot be started , But the gateway does not have any exception logs , Just waiting all the time , see nacos The service is not registered properly ; Start the gateway first , All services can start normally , Obstetrics and Gynecology nacos service , All services can be registered normally .
It turns out that Feign Lead to ,Spring Cloud Gateway Use OpenFeign stuck , It won't start . When in gateway Use in gateway Feign when , It will lead to gateway Gateway boot stuck , However, no error is reported .

There is no abnormal condition in the log , The detailed log is as follows :

 :: Spring Boot ::                (v2.7.0)

2022-06-04 20:41:37.627  INFO 28144 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:/Users/carter/nacos/config
2022-06-04 20:41:37.644  INFO 28144 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0
2022-06-04 20:41:37.712  INFO 28144 --- [           main] c.a.nacos.client.config.utils.JvmUtil    : isMultiInstance:false
2022-06-04 20:41:37.731  WARN 28144 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[gateway] & group[DEFAULT_GROUP]
2022-06-04 20:41:37.757  WARN 28144 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[gateway.yml] & group[DEFAULT_GROUP]
2022-06-04 20:41:37.758  INFO 28144 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-gateway.yml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-gateway,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-allows.yaml,DEFAULT_GROUP'}]
2022-06-04 20:41:37.764  INFO 28144 --- [           main] com.cloud.gateway.GatewayApplication     : No active profile set, falling back to 1 default profile: "default"
2022-06-04 20:41:38.210  INFO 28144 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-06-04 20:41:38.211  INFO 28144 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2022-06-04 20:41:38.225  INFO 28144 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 Redis repository interfaces.
2022-06-04 20:41:38.346  INFO 28144 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=d6da96dc-ee00-3f1d-b951-2210fa3441c0
2022-06-04 20:41:38.356  INFO 28144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'validatorConfiguration' of type [com.common.exception.validation.ValidatorConfiguration$$EnhancerBySpringCGLIB$$8078cc58] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-04 20:41:38.370  INFO 28144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [org.hibernate.validator.internal.engine.ValidatorImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-04 20:41:38.465  INFO 28144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-04 20:41:38.467  INFO 28144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-04 20:41:38.470  INFO 28144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'reactorDeferringLoadBalancerExchangeFilterFunction' of type [org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [After]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Before]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Between]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Cookie]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Header]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Host]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Method]
2022-06-04 20:41:39.656  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Path]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Query]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [ReadBody]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [RemoteAddr]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [XForwardedRemoteAddr]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Weight]
2022-06-04 20:41:39.657  INFO 28144 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [CloudFoundryRouteService]
2022-06-04 20:41:39.699  INFO 28144 --- [oundedElastic-1] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null
2022-06-04 20:41:39.699  INFO 28144 --- [oundedElastic-1] com.alibaba.nacos.client.naming          : initializer namespace from System Environment :null
2022-06-04 20:41:39.699  INFO 28144 --- [oundedElastic-1] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null
2022-06-04 20:41:39.842  INFO 28144 --- [oundedElastic-3] com.alibaba.nacos.client.naming          : new ips(1) service: [email protected]@user-center -> [{"instanceId":"192.168.1.108#9002#DEFAULT#[email protected]@user-center","ip":"192.168.1.108","port":9002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"[email protected]@user-center","metadata":{"preserved.register.source":"SPRING_CLOUD"},"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
2022-06-04 20:41:39.847  INFO 28144 --- [oundedElastic-3] com.alibaba.nacos.client.naming          : current ips:(1) service: [email protected]@user-center -> [{"instanceId":"192.168.1.108#9002#DEFAULT#[email protected]@user-center","ip":"192.168.1.108","port":9002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"[email protected]@user-center","metadata":{"preserved.register.source":"SPRING_CLOUD"},"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
2022-06-04 20:43:43.034  WARN 28144 --- [.naming.updater] com.alibaba.nacos.client.naming          : out of date data received, old-t: 1654346563261, new-t: 0

Log image :
 Insert picture description here
Solution :
1. Modify the configuration

	 Because of the configuration spring.cloud.gateway.discovery.locator.enabled = true Lead to , Change it to false Or remove the configuration , Because the default is false, However, this scheme will cause dynamic routing to fail to load , Affect microservice invocation .
    gateway:
      discovery:
        locator:
          enabled: false          

2.feign Injection uses lazy loading

    //  The key : You have to use @Lazy
    @Lazy
    @Autowired
    private Oauth2Client oauth2Client;

Relevant big data learning demo Address :
https://github.com/carteryh/big-data

原网站

版权声明
本文为[qq_ twenty-one million four hundred and eighty thousand three h]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206112055443414.html