Org.springframework.beans.factory.BeanCreationNotAllowedException: ошибка создания bean-компонента с именем 'eurekaAutoServiceRegistration': Singleton bean crea

Я разрабатываю пример Spring Boot + Microservices. Я взял ссылку по ссылке: https://github.com/PacktPublishing/Mastering-Spring-Cloud/tree/master/Chapter06/sample-spring-cloud-comm-feign.

В этом примере я могу успешно запустить discovery-service и gateway-service, но когда я пытался запустить любую другую службу, я получаю ошибку ниже.

Одна вещь, которую я заметил, что инструкции не очень ясны о том, как выполнять код, даже если это не упомянуто четко в книге.

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
19:05:25.564 ERROR 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

19:05:25.564 INFO  Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1992eaf4: startup date [Mon Dec 24 19:05:14 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@48aca48b
19:05:25.564 INFO  Unregistering application customer-service with eureka with status DOWN
19:05:25.564 WARN  Saw local status change event StatusChangeEvent [timestamp=1545658525564, current=DOWN, previous=UP]
19:05:25.564 INFO  DiscoveryClient_CUSTOMER-SERVICE/localhost:customer-service: registering service...
19:05:25.564 INFO  Stopping beans in phase 0
19:05:25.579 INFO  DiscoveryClient_CUSTOMER-SERVICE/localhost:customer-service - registration status: 204
19:05:26.017 INFO  Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4a064404: startup date [Mon Dec 24 19:05:26 IST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1992eaf4
19:05:26.061 INFO  JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
19:05:26.221 INFO  Flipping property: localhost.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
19:05:26.221 INFO  Shutdown hook installed for: NFLoadBalancer-PingTimer-localhost
19:05:26.254 INFO  Client: localhost instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=localhost,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
19:05:26.288 INFO  Using serverListUpdater PollingServerListUpdater
19:05:26.288 INFO  DynamicServerListLoadBalancer for client localhost initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=localhost,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@1ba156fc
19:05:26.585 INFO  Unregistering JMX-exposed beans on shutdown
19:05:26.585 INFO  Unregistering JMX-exposed beans
19:05:26.585 INFO  Shutting down DiscoveryClient ...
19:05:26.585 INFO  Unregistering ...
19:05:26.606 INFO  DiscoveryClient_CUSTOMER-SERVICE/localhost:customer-service - deregister  status: 200
19:05:26.607 INFO  Completed shut down of DiscoveryClient
19:05:26.607 INFO  Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4a064404: startup date [Mon Dec 24 19:05:26 IST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1992eaf4
19:05:26.607 WARN  Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:216)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.getTargetBean(ApplicationListenerMethodAdapter.java:283)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:253)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:177)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:140)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:991)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
    at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:76)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:272)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at pl.piomin.services.customer.CustomerApplication.main(CustomerApplication.java:22)
19:05:26.607 INFO  Shutdown hook removed for: NFLoadBalancer-PingTimer-localhost
19:05:26.607 INFO  Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1491344a: startup date [Mon Dec 24 19:05:17 IST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1992eaf4
19:05:26.607 WARN  Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaAutoServiceRegistration': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
Освоение архитектуры микросервисов с Laravel: Лучшие практики, преимущества и советы для разработчиков
Освоение архитектуры микросервисов с Laravel: Лучшие практики, преимущества и советы для разработчиков
В последние годы архитектура микросервисов приобрела популярность как способ построения масштабируемых и гибких приложений. Laravel , популярный PHP...
Создание микрофронтендов с Angular и федерацией модулей в монорепо: Пошаговое руководство
Создание микрофронтендов с Angular и федерацией модулей в монорепо: Пошаговое руководство
Микрофронтенды стали популярным архитектурным паттерном для веб-разработки. С появлением федерации модулей в Webpack 5 реализация микрофронтендов...
1
0
2 698
2

Ответы 2

Измените порт в application.yml, если у вас есть свойства ниже. В вашей системе tomcat, вероятно, работает с портом по умолчанию 8080.

сервер:
порт: $ {PORT: 8080}

Надеюсь, что приведенное выше изменение может вам помочь.

https://github.com/spring-cloud/spring-cloud-netflix/commit/12583fd0c25638f95c14973d921ca28cdcd17df5

обновите весеннюю облачную версию до Greenwich.SR6 , вопрос исчезнет

Другие вопросы по теме

Похожие вопросы