spring-cloud-bus-kafka创建applciationcontext两次

时间:2016-06-27 08:05:42

标签: spring apache-kafka spring-cloud spring-cloud-bus

云版是Brixton.SR1 ....

我使用sping-cloud-bus-kafka和sping-cloud-zookeeper-all(使用zookeeper发现),每次在zookeeper中有两个项目,如:

zookeeper数据: zookeeper data image

我的yml是: my yml

启动时,它创建applicationcontext两次,kafka生成器两次,zookeeperclient两次,堆栈跟踪是:

第一次:

Thread [main] (Suspended (breakpoint at line 765 in ZooKeeper))     
ZooKeeper.create(String, byte[], List<ACL>, CreateMode) line: 765   
CreateBuilderImpl$11.call() line: 721   
CreateBuilderImpl$11.call() line: 704   
RetryLoop.callWithRetry(CuratorZookeeperClient, Callable<T>) line: 108  
CreateBuilderImpl.pathInForeground(String, byte[]) line: 701    
CreateBuilderImpl.protectedPathInForeground(String, byte[]) line: 477   
CreateBuilderImpl.forPath(String, byte[]) line: 467 
CreateBuilderImpl.forPath(String, byte[]) line: 44  
ServiceDiscoveryImpl<T>.internalRegisterService(ServiceInstance<T>) line: 224   
ServiceDiscoveryImpl<T>.reRegisterServices() line: 444  
ServiceDiscoveryImpl<T>.start() line: 131   
ZookeeperLifecycle.register() line: 55  
ZookeeperLifecycle(AbstractDiscoveryLifecycle).start() line: 102    
DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 
DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51  
DefaultLifecycleProcessor$LifecycleGroup.start() line: 346  
DefaultLifecycleProcessor.startBeans(boolean) line: 149 
DefaultLifecycleProcessor.onRefresh() line: 112 
AnnotationConfigApplicationContext(AbstractApplicationContext).finishRefresh() line: 852    
AnnotationConfigApplicationContext(AbstractApplicationContext).refresh() line: 541  
SpringApplication.refresh(ApplicationContext) line: 766 
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361    
SpringApplication.run(String...) line: 307  
SpringApplicationBuilder.run(String...) line: 134   
BootstrapApplicationListener.bootstrapServiceContext(ConfigurableEnvironment, SpringApplication) line: 140  
BootstrapApplicationListener.onApplicationEvent(ApplicationEnvironmentPreparedEvent) line: 84   
BootstrapApplicationListener.onApplicationEvent(ApplicationEvent) line: 62  
SimpleApplicationEventMulticaster.invokeListener(ApplicationListener, ApplicationEvent) line: 166   
SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent, ResolvableType) line: 138    
SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 121    
EventPublishingRunListener.publishEvent(SpringApplicationEvent) line: 111   
EventPublishingRunListener.environmentPrepared(ConfigurableEnvironment) line: 65    
SpringApplicationRunListeners.environmentPrepared(ConfigurableEnvironment) line: 54 
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 330    
SpringApplication.run(String...) line: 307  
BaseApplication.main(String[]) line: 42 
Hello.main(String[]) line: 15   

第二次:

Thread [main] (Suspended (breakpoint at line 765 in ZooKeeper)) 
ZooKeeper.create(String, byte[], List<ACL>, CreateMode) line: 765   
CreateBuilderImpl$11.call() line: 721   
CreateBuilderImpl$11.call() line: 704   
RetryLoop.callWithRetry(CuratorZookeeperClient, Callable<T>) line: 108  
CreateBuilderImpl.pathInForeground(String, byte[]) line: 701    
CreateBuilderImpl.protectedPathInForeground(String, byte[]) line: 477   
CreateBuilderImpl.forPath(String, byte[]) line: 467 
CreateBuilderImpl.forPath(String, byte[]) line: 44  
ServiceDiscoveryImpl<T>.internalRegisterService(ServiceInstance<T>) line: 224   
ServiceDiscoveryImpl<T>.reRegisterServices() line: 444  
ServiceDiscoveryImpl<T>.start() line: 131   
ZookeeperLifecycle.register() line: 55  
ZookeeperLifecycle(AbstractDiscoveryLifecycle).start() line: 102    
DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 
DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51  
DefaultLifecycleProcessor$LifecycleGroup.start() line: 346  
DefaultLifecycleProcessor.startBeans(boolean) line: 149 
DefaultLifecycleProcessor.onRefresh() line: 112 
AnnotationConfigApplicationContext(AbstractApplicationContext).finishRefresh() line: 852    
AnnotationConfigApplicationContext(AbstractApplicationContext).refresh() line: 541  
SpringApplication.refresh(ApplicationContext) line: 766 
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361    
SpringApplication.run(String...) line: 307  
SpringApplicationBuilder.run(String...) line: 134   
BootstrapApplicationListener.bootstrapServiceContext(ConfigurableEnvironment, SpringApplication) line: 140  
BootstrapApplicationListener.onApplicationEvent(ApplicationEnvironmentPreparedEvent) line: 84   
BootstrapApplicationListener.onApplicationEvent(ApplicationEvent) line: 62  
SimpleApplicationEventMulticaster.invokeListener(ApplicationListener, ApplicationEvent) line: 166   
SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent, ResolvableType) line: 138    
SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 121    
EventPublishingRunListener.publishEvent(SpringApplicationEvent) line: 111   
EventPublishingRunListener.environmentPrepared(ConfigurableEnvironment) line: 65    
SpringApplicationRunListeners.environmentPrepared(ConfigurableEnvironment) line: 54 
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 330    
SpringApplication.run(String...) line: 307  
SpringApplicationBuilder.run(String...) line: 134   
DefaultBinderFactory<T>.getBinder(String) line: 156 
ChannelBindingService.getBinderForChannel(String) line: 142 
ChannelBindingService.bindProducer(MessageChannel, String) line: 104    
BindableProxyFactory.bindOutputs(ChannelBindingService) line: 205   
OutputBindingLifecycle.start() line: 57 
DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 
DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51  
DefaultLifecycleProcessor$LifecycleGroup.start() line: 346  
DefaultLifecycleProcessor.startBeans(boolean) line: 149 
DefaultLifecycleProcessor.onRefresh() line: 112 
AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).finishRefresh() line: 852 
AnnotationConfigEmbeddedWebApplicationContext(EmbeddedWebApplicationContext).finishRefresh() line: 140  
AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).refresh() line: 541   
AnnotationConfigEmbeddedWebApplicationContext(EmbeddedWebApplicationContext).refresh() line: 118    
SpringApplication.refresh(ApplicationContext) line: 766 
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361    
SpringApplication.run(String...) line: 307  
BaseApplication.main(String[]) line: 42 
Hello.main(String[]) line: 15   

谁知道会发生什么????

感谢.....

0 个答案:

没有答案