spring cloud 网关调用config模块启动问题:
03-11 17:13:29.869[INFO ][ main][o.s.b.w.e.t.TomcatWebServer ][ 91]: Tomcat initialized with port(s): 8081 (http)
03-11 17:13:29.928[INFO ][ main][o.a.c.c.StandardService ][ 180]: Starting service [Tomcat]
03-11 17:13:29.928[INFO ][ main][o.a.c.c.StandardEngine ][ 180]: Starting Servlet Engine: Apache Tomcat/8.5.35
03-11 17:13:29.936[INFO ][tartStop-1][o.a.c.c.AprLifecycleListener ][ 180]: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/lichengying/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
03-11 17:13:30.181[INFO ][tartStop-1][o.a.c.c.C.[.[.[/] ][ 180]: Initializing Spring embedded WebApplicationContext
03-11 17:13:30.183[INFO ][tartStop-1][o.s.w.c.ContextLoader ][ 296]: Root WebApplicationContext: initialization completed in 3608 ms
03-11 17:13:30.289[INFO ][tartStop-1][cConfig$$EnhancerBySpringCGLIB$$b209e387][ 60]: CORS allowed-origins: []
03-11 17:13:30.653[WARN ][tartStop-1][c.n.c.s.URLConfigurationSource ][ 121]: No URLs will be polled as dynamic configuration sources.
03-11 17:13:30.653[INFO ][tartStop-1][c.n.c.s.URLConfigurationSource ][ 122]: To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
03-11 17:13:30.663[INFO ][tartStop-1][c.n.c.DynamicPropertyFactory ][ 281]: DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@7dd21d1b
03-11 17:13:30.967[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 958]: Disable delta property : false
03-11 17:13:30.967[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 959]: Single vip registry refresh property : null
03-11 17:13:30.968[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 960]: Force full registry fetch : false
03-11 17:13:30.968[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 961]: Application is null : false
03-11 17:13:30.968[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 962]: Registered Applications size is zero : true
03-11 17:13:30.968[INFO ][Executor-0][c.n.d.DiscoveryClient ][ 964]: Application version is -1: false
03-11 17:13:30.969[INFO ][Executor-0][c.n.d.DiscoveryClient ][1047]: Getting all instance registry info from the eureka server
03-11 17:13:30.975[INFO ][Executor-0][c.n.d.DiscoveryClient ][1056]: The response status is 200
03-11 17:13:30.975[WARN ][Executor-0][lientConfigServiceBootstrapConfiguration][ 120]: Could not locate configserver via discovery
java.lang.IllegalStateException: No instances found of configserver (*****-config)
at org.springframework.cloud.config.client.ConfigServerInstanceProvider.getConfigServerInstances(ConfigServerInstanceProvider.java:25)
at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration.refresh(DiscoveryClientConfigServiceBootstrapConfiguration.java:84)
at org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration.heartbeat(DiscoveryClientConfigServiceBootstrapConfiguration.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261)
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180)
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)
at org.springframework.cloud.netflix.eureka.CloudEurekaClient.onCacheRefreshed(CloudEurekaClient.java:112)
at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:981)
at com.netflix.discovery.DiscoveryClient.refreshRegistry(DiscoveryClient.java:1473)
at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1440)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
03-11 17:13:32.216[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'characterEncodingFilter' to: [/*]
03-11 17:13:32.216[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'webMvcMetricsFilter' to: [/*]
03-11 17:13:32.217[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
03-11 17:13:32.217[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'httpPutFormContentFilter' to: [/*]
03-11 17:13:32.217[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'requestContextFilter' to: [/*]
03-11 17:13:32.217[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'corsFilter' to: [/*]
03-11 17:13:32.218[INFO ][tartStop-1][o.s.b.w.s.FilterRegistrationBean ][ 245]: Mapping filter: 'httpTraceFilter' to: [/*]
03-11 17:13:32.218[INFO ][tartStop-1][o.s.b.w.s.ServletRegistrationBean ][ 187]: Servlet dispatcherServlet mapped to [/]
03-11 17:13:32.219[INFO ][tartStop-1][o.s.b.w.s.ServletRegistrationBean ][ 187]: Servlet zuulServlet mapped to [/zuul/*]
03-11 17:13:32.221[INFO ][tartStop-1][o.s.b.a.e.w.ServletEndpointRegistrar ][ 78]: Registered '/actuator/hystrix.stream' to hystrix.stream-actuator-endpoint
03-11 17:13:32.649[WARN ][ main][c.n.c.s.URLConfigurationSource ][ 121]: No URLs will be polled as dynamic configuration sources.
03-11 17:13:32.650[INFO ][ main][c.n.c.s.URLConfigurationSource ][ 122]: To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
03-11 17:13:33.074[INFO ][ main][s.w.s.m.m.a.RequestMappingHandlerAdapter][ 588]: Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@58a63629: startup date [Mon Mar 11 17:13:26 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3646a422
03-11 17:13:33.273[WARN ][ main][ConfigServletWebServerApplicationContext][ 556]: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'redisTemplate' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
03-11 17:13:33.306[INFO ][ main][o.a.c.c.StandardService ][ 180]: Stopping service [Tomcat]
03-11 17:13:33.314[WARN ][tartStop-1][o.a.c.l.WebappClassLoaderBase ][ 180]: The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
03-11 17:13:33.331[INFO ][ main][ConditionEvaluationReportLoggingListener][ 142]:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
03-11 17:13:33.522[ERROR][ main][o.s.b.d.LoggingFailureAnalysisReporter ][ 42]:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method redisTemplate in org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'redisConnectionFactory' in 'JedisConnectionConfiguration' not loaded because @ConditionalOnClass did not find required classes 'org.apache.commons.pool2.impl.GenericObjectPool', 'redis.clients.jedis.Jedis'
- Bean method 'redisConnectionFactory' in 'LettuceConnectionConfiguration' not loaded because @ConditionalOnClass did not find required class 'io.lettuce.core.RedisClient'
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' in your configuration.
Process finished with exit code 1
是在配置文件中没有找到defaultZone相应的路径或者路径配置错误,亲测是服务未发现导致的,所有需要发现服务的地方都需要加入
org.springframework.cloud spring-cloud-starter-netflix-eureka-client commons-logging commons-logging
eureka
client:
registry-fetch-interval-seconds: 5
fetch-registry: true
service-url:
defaultZone: