问题一
①:由于项目采用分布式架构
②:本人负责的服务与其它服务有交互
③:其他人服务则微服务调用自己负责的服务(feigin调用)
由以上的环境产生:上生产换季时候的时候,别人服务调不通,我负责的服务(作为一位开发,先是,确定,他调用我的接口,接口是否存在,因自己服务迅速定位,在哪个页面,证明问题不在自己服务这边,开始让另一个服务找自己的问题,经过一段时间调试,竟然是那边服务在path中拼接的是大写的服务名)。
如下正常写法:
错误的写法:
问题二
场景:
①:配置中心统一由apollo管理
②:因一位开发工程师手敲appid(正常:auth1-service 错误:auth-service)
现象:
项目部署平台后,无法启动出现错误,导致每次刷新重启,作为一名从事开发四年多程序员我的建议是,直接那日志,看日志的加载,到底哪步出错(不是自己负责的建议),另一位开发比咱工作经验时间长好几年,说不用,直接拿下jar包来跑程序(我也认可,个人认为分析springcloud启动加载日志完全可以查出),当然最后通过此法好像是找出了这个问题(由于本人爱看日志分析,自己用本复现了他们的场景)
复现场景
2021-12-10 10:01:08.850|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.foundation.internals.provider.DefaultApplicationProvider|initAppId|line:85|App ID is set to auth1-service by app.id property from System Property
2021-12-10 10:01:08.854|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.foundation.internals.provider.DefaultServerProvider|initEnvType|line:130|Environment is set to null. Because it is not available in either (1) JVM system property 'env', (2) OS env variable 'ENV' nor (3) property 'env' from the properties InputStream.
2021-12-10 10:01:08.915|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.DefaultMetaServerProvider|initMetaServerAddress|line:42|Located meta services from apollo.meta configuration: http://192.168.1.249:8080!
2021-12-10 10:01:08.921|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.core.MetaDomainConsts|initMetaServerAddress|line:93|Located meta server address http://192.168.1.249:8080 for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider
2021-12-10 10:01:10.422|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application.yml
2021-12-10 10:01:11.593|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application.yml, url: http://192.168.1.249:8080/configs/auth1-service/default/application.yml?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application.yml, please check whether the configs are released in Apollo!]
2021-12-10 10:01:11.752|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application.yml
2021-12-10 10:01:12.907|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application.yml, url: http://192.168.1.249:8080/configs/auth1-service/default/application.yml?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application.yml, please check whether the configs are released in Apollo!]
2021-12-10 10:01:13.027|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application.yml
2021-12-10 10:01:14.309|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application.yml, url: http://192.168.1.249:8080/configs/auth1-service/default/application.yml?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application.yml, please check whether the configs are released in Apollo!]
2021-12-10 10:01:14.310|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.LocalFileConfigRepository, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+application.yml.properties]
2021-12-10 10:01:14.467|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application.yml
2021-12-10 10:01:15.684|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application.yml, url: http://192.168.1.249:8080/configs/auth1-service/default/application.yml?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application.yml, please check whether the configs are released in Apollo!]
2021-12-10 10:01:15.685|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigFile|initialize|line:55|Init Apollo Config File failed - namespace: application.yml, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+application.yml.properties].
2021-12-10 10:01:15.914|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: config-uims.properties
2021-12-10 10:01:17.078|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: config-uims.properties, url: http://192.168.1.249:8080/configs/auth1-service/default/config-uims.properties?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: config-uims.properties, please check whether the configs are released in Apollo!]
2021-12-10 10:01:17.273|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: config-uims.properties
2021-12-10 10:01:18.558|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: config-uims.properties, url: http://192.168.1.249:8080/configs/auth1-service/default/config-uims.properties?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: config-uims.properties, please check whether the configs are released in Apollo!]
2021-12-10 10:01:18.746|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: config-uims.properties
2021-12-10 10:01:19.957|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: config-uims.properties, url: http://192.168.1.249:8080/configs/auth1-service/default/config-uims.properties?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: config-uims.properties, please check whether the configs are released in Apollo!]
2021-12-10 10:01:19.958|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.LocalFileConfigRepository, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+config-uims.properties.properties]
2021-12-10 10:01:20.239|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: config-uims.properties
2021-12-10 10:01:21.486|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: config-uims.properties, url: http://192.168.1.249:8080/configs/auth1-service/default/config-uims.properties?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: config-uims.properties, please check whether the configs are released in Apollo!]
2021-12-10 10:01:21.487|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.DefaultConfig|initialize|line:61|Init Apollo Local Config failed - namespace: config-uims.properties, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+config-uims.properties.properties].
2021-12-10 10:01:21.764|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.DefaultConfig|getProperty|line:95|Could not load config for namespace config-uims.properties from Apollo, please check whether the configs are released in Apollo! Return default value now!
2021-12-10 10:01:21.765|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|com.unicom.fcp.UimsServiceApplication|logStartupProfileInfo|line:652|The following profiles are active: fat
2021-12-10 10:01:24.277|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|org.springframework.boot.actuate.endpoint.EndpointId|logWarning|line:131|Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2021-12-10 10:01:24.757|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.cloud.context.scope.GenericScope|setSerializationId|line:294|BeanFactory id=088982fc-799f-3417-ae64-4cf05064df68
2021-12-10 10:01:25.063|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application
2021-12-10 10:01:26.306|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application, url: http://192.168.1.249:8080/configs/auth1-service/default/application?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application, please check whether the configs are released in Apollo!]
2021-12-10 10:01:26.493|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application
2021-12-10 10:01:27.765|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application, url: http://192.168.1.249:8080/configs/auth1-service/default/application?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application, please check whether the configs are released in Apollo!]
2021-12-10 10:01:28.076|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application
2021-12-10 10:01:29.276|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application, url: http://192.168.1.249:8080/configs/auth1-service/default/application?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application, please check whether the configs are released in Apollo!]
2021-12-10 10:01:29.277|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.AbstractConfigRepository|trySync|line:26|Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.LocalFileConfigRepository, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+application.properties]
2021-12-10 10:01:29.498|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.RemoteConfigRepository|loadApolloConfig|line:194|Load config failed, will retry in 1 SECONDS. appId: auth1-service, cluster: default, namespaces: application
2021-12-10 10:01:30.780|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.LocalFileConfigRepository|trySyncFromUpstream|line:167|Sync config from upstream repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository failed, reason: Load Apollo Config failed - appId: auth1-service, cluster: default, namespace: application, url: http://192.168.1.249:8080/configs/auth1-service/default/application?ip=192.168.42.122 [Cause: [status code: 404] Could not find config for namespace - appId: auth1-service, cluster: default, namespace: application, please check whether the configs are released in Apollo!]
2021-12-10 10:01:30.781|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.DefaultConfig|initialize|line:61|Init Apollo Local Config failed - namespace: application, reason: Load config from local config failed! [Cause: Cannot read from local cache file C:\opt\data\auth1-service\config-cache\auth1-service+default+application.properties].
2021-12-10 10:01:30.793|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor|registerErrorChannel|line:193|No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2021-12-10 10:01:30.806|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor|registerTaskScheduler|line:280|No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2021-12-10 10:01:30.814|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor|registerHeaderChannelRegistry|line:431|No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2021-12-10 10:01:30.904|[main]|WARN |traceID:|uIP:|sip:${sys:sIP}|com.ctrip.framework.apollo.internals.DefaultConfig|getProperty|line:95|Could not load config for namespace application from Apollo, please check whether the configs are released in Apollo! Return default value now!
2021-12-10 10:01:31.004|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$2cdf0cd2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.041|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$97d0c801] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.053|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationJmxConfiguration' of type [org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationJmxConfiguration$$EnhancerBySpringCGLIB$$7362d321] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.074|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration' of type [org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration$$EnhancerBySpringCGLIB$$ac4a7bee] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.084|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'mbeanServer' of type [com.sun.jmx.mbeanserver.JmxMBeanServer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.119|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-10 10:01:31.169|[main]|INFO |traceID:|uIP:|sip:${sys:sIP}|org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker|postProcessAfterInitialization|line:330|Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$48f90fcf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
通过日志很好的查看出了原因。