我有microservice项目访问公共配置服务器的权限。但是,eugene客户机的配置可以正常工作,但是apachekafka无法正常工作。
spring配置服务器
@SpringBootApplication
@EnableEurekaClient
@EnableConfigServer
public class FeteBirdConfigurationServerApplication {
public static void main(String[] args) {
SpringApplication.run(FeteBirdConfigurationServerApplication.class, args);
}
}
引导.yml
spring:
cloud:
config:
server:
git:
uri: https://github.com/anandjaisy/Microservice-Cloud-Config
配置服务器
spring:
application:
name: CONFIG-SERVER
server:
port: 8085
Git回购
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8761/eureka/
instance:
hostname: localhost
spring:
kafka:
producer:
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
micoservice访问配置服务器
引导.yml
spring:
cloud:
config:
uri:
- http://localhost:8085
如果我将kafka config放在microservice application.yml文件中,配置可以工作,但是如果我删除并尝试访问配置服务器,它就不工作了。spring:应用程序:名称:订单服务kafka:生产者:值序列化程序:org.springframework.kafka.support.serializer.jsonserializer
来自微服务的日志
2020-07-13 15:11:08.441 INFO 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8085
2020-07-13 15:11:08.992 INFO 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8085. Will be trying the next url if available
2020-07-13 15:11:08.999 WARN 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8085/ORDER-SERVICE/dev": Connection refused; nested exception is java.net.ConnectException: Connection refused
2020-07-13 15:11:09.004 INFO 2025 --- [ restartedMain] f.b.f.FeteBirdOrderApplication : The following profiles are active: dev
2020-07-13 15:11:17.529 WARN 2025 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-07-13 15:11:18.328 INFO 2025 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=0bb24ffe-2fc1-3960-867f-4b6e7735d255
2020-07-13 15:11:20.952 INFO 2025 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2020-07-13 15:11:21.095 INFO 2025 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-07-13 15:11:21.096 INFO 2025 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36]
2020-07-13 15:11:21.612 INFO 2025 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-07-13 15:11:21.613 INFO 2025 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 12525 ms
2020-07-13 15:11:22.495 WARN 2025 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-07-13 15:11:22.495 INFO 2025 --- [ restartedMain] 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.
2020-07-13 15:11:22.541 INFO 2025 --- [ restartedMain] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@59982a7
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/Users/macbook/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.7.RELEASE/56e14a3a5e2813534b5db2da1502cd58ab5bc61d/spring-core-5.2.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-07-13 15:11:31.448 INFO 2025 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 17 endpoint(s) beneath base path '/actuator'
2020-07-13 15:11:32.508 WARN 2025 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-07-13 15:11:32.508 INFO 2025 --- [ restartedMain] 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.
2020-07-13 15:11:32.931 INFO 2025 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-13 15:11:33.094 WARN 2025 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
2020-07-13 15:11:34.161 WARN 2025 --- [ restartedMain] ockingLoadBalancerClientRibbonWarnLogger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
暂无答案!
目前还没有任何答案,快来回答吧!