Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeanCreationNotAllowedException on shutdown for EurekaDiscoveryClientConfiguration #1064

Open
Pinny3 opened this issue May 30, 2016 · 17 comments
Labels

Comments

@Pinny3
Copy link

Pinny3 commented May 30, 2016

I've got a Spring-Boot-Parent defined in my pom.xml like this:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Brixton.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

I annotated my Application-Class like this:

@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableFeignClients
@SpringBootApplication

Then I've got an FEIGN interface defined like this:

@FeignClient(name = "IMPRINT-SERVICE", fallback = ImprintDTO.Fallback.class)
public interface ImprintRequest {

@RequestMapping(method = RequestMethod.GET, value = "/v1/imprint/education", headers = "Accept=application/json")
    ImprintDTO getImprint();
}

Then I've got service-class like this:

@Service
public class ImprintService {

    @Inject
    ImprintRequest imprintRequest;

    public ImprintDTO getImprint() {
        return imprintRequest.getImprint();
    }

}

Then I've got a test-class defined like this:

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest
public class ImprintServiceTest  {

    @Inject
    private ImprintService imprintService;

    @Test
    public void thatGetImprintWorks() throws Exception {

        //when
        final ImprintDTO imprint = imprintService.getImprint();

        //then
        assertNotNull(imprint);
        assertNotNull(imprint.getProjectLead());
    }

}

If I run the test everything is doing fine, but after the test has been run and the spring application is shutdown I received this ugly exception:

2016-05-30 10:53:39.666  WARN 1578 --- [       Thread-4] s.c.a.AnnotationConfigApplicationContext : Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration': Singleton bean creation not allowed while the 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:1054)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.getTargetBean(ApplicationListenerMethodAdapter.java:254)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:224)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:144)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:106)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:387)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:967)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
    at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:66)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:262)
    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:972)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:901)

2016-05-30 10:53:39.667  INFO 1578 --- [       Thread-4] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook removed for: NFLoadBalancer-PingTimer-IMPRINT-SERVICE
2016-05-30 10:53:39.668  INFO 1578 --- [       Thread-4] c.n.u.concurrent.ShutdownEnabledTimer    : Exception caught (might be ok if at shutdown)

java.lang.IllegalStateException: Shutdown in progress
    at java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82)
    at java.lang.Runtime.removeShutdownHook(Runtime.java:239)
    at com.netflix.util.concurrent.ShutdownEnabledTimer.cancel(ShutdownEnabledTimer.java:70)
    at com.netflix.loadbalancer.BaseLoadBalancer.cancelPingTask(BaseLoadBalancer.java:614)
    at com.netflix.loadbalancer.BaseLoadBalancer.shutdown(BaseLoadBalancer.java:886)
    at com.netflix.loadbalancer.DynamicServerListLoadBalancer.shutdown(DynamicServerListLoadBalancer.java:375)
    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:483)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:354)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:277)
    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:972)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
    at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:66)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:262)
    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:972)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:901)

2016-05-30 10:53:39.682  WARN 1578 --- [       Thread-4] s.c.a.AnnotationConfigApplicationContext : Exception thrown from ApplicationListener handling ContextClosedEvent

org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration': Singleton bean creation not allowed while the 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:1054)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.getTargetBean(ApplicationListenerMethodAdapter.java:254)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:224)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:144)
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:106)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:387)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:967)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
    at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:66)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:262)
    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:972)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:979)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
    at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:901)

Is there any way to avoid this exception?

@dsyer dsyer changed the title Receive a BeanCreationNotAllowedException for EurekaDiscoveryClientConfiguration BeanCreationNotAllowedException on shutdown for EurekaDiscoveryClientConfiguration Jun 1, 2016
@dsyer
Copy link
Contributor

dsyer commented Jun 1, 2016

You've got WARN and INFO logs there, so probably you can just ignore them, or shut them off by disabling the loggers. If you have a crisp way to reproduce the problem with a simple sample project in github maybe we can analyse it in a bit more detail.

@keyhan
Copy link

keyhan commented Jun 16, 2016

I get the same error and the application refuses to start in Eclipse and also Integration tests fails because of same error. This is an issue to look into.

@dsyer
Copy link
Contributor

dsyer commented Jun 16, 2016

Which application are you talking about? If you have a sample, please share a link.

@eshkel
Copy link

eshkel commented Jul 15, 2016

Hi Dave,
I got similar exception, application is pretty simple (in addition I have Eureka server with two services: SERVICE1 and SERVICE2)

@SpringBootApplication
@EnableEurekaClient
public class Application {

    public static void main(String[] args) {
        System.setProperty("spring.config.name", "test-app");
        new SpringApplicationBuilder(Application.class)
                .web(false)
                .run(args);
    }
}

@Component
class LoadBalancerExample implements CommandLineRunner {

    @Autowired
    private LoadBalancerClient loadBalancer;

    @Override
    public void run(String... strings) throws Exception {
        ServiceInstance instance1 = loadBalancer.choose("SERVICE1");
        System.out.println("SERVICE1                           " + instance1.getUri());
        ServiceInstance instance2 = loadBalancer.choose("SERVICE2");
        System.out.println("SERVICE2                           " + instance2.getUri());
    }
}

The cause of mentioned exception is in method org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration.onApplicationEvent(ContextClosedEvent event) line 188

according to http://docs.spring.io/spring/docs/2.5.x/reference/beans.html#context-functionality-events the ContextClosedEvent called when all singletones destroyes, but the ApplicationListenerMethodAdapter trying to instantiate wrapped bean for handling ContextClosedEvent and this cause exception. Is it worth to replace ContextClosedEvent with ContextStoppedEvent for EurekaDiscoveryClientConfiguration.onApplicationEvent ?

@spencergibb
Copy link
Member

Can anyone on this thread provide a sample application?

@eshkel
Copy link

eshkel commented Oct 19, 2016

boot.shtdwn.error.zip

first execute 'gradle bootRun' in test.eureka, after eureka started - run 'gradle bootRun' in test.shtdwn

PS: if using eclipse - just import projects and run as boot app in same order.

@spencergibb
Copy link
Member

@cecchisandrone
Copy link

I have the same issue when calling the /shutdown Actuator endpoint

@brenuart
Copy link
Contributor

brenuart commented Mar 6, 2017

The issue is due to the following:

  • EurekaDiscoveryClientConfiguration implements SmartLifeCycle and is being closed first
  • it is also a @EventListener(ContextClosedEvent.class) that supposed to be invoked when the context is being closed. Unfortunately, the bean has already been disposed at this time (because of the SmartLifecycle). Hence the reason why Spring complains...

At least that's how we understood the issue here... If this analysis happens to be correct, then it is likely you will provide a solution to #1534 at the same time.

@CNoetzel
Copy link

This issue seems to be related to spring-cloud-samples/feign-eureka#6. After I removed the FeignClients Annotation from the Application, the error seems to be gone.

@crmky
Copy link

crmky commented Aug 15, 2017

See #1952 . The root cause should be the same.

@andysworkshop
Copy link

I see that #2087 fixes this. Will this make it into a Dalston SR release.

@spencergibb
Copy link
Member

#2087 is in Edgware.RELEASE, can anyone confirm this fixes it?

@spencergibb
Copy link
Member

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@sanketdhamode
Copy link

sanketdhamode commented May 14, 2018

Am using 1.4.4.RELEASE version of below dependecies and still i see this issue.

  <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
         <version>${spring-cloud-netflix.version}</version>
     </dependency>
     <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
         <version>${spring-cloud-netflix.version}</version>
     </dependency>
2018-05-14 11:31:35.637 [Thread-5] WARN  org.springframework.context.annotation.AnnotationConfigApplicationContext - 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:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
        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.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: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:583)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:555)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:516)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1032)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1008)
        at org.springframework.context.support.AbstractApplicationContext$2.run(AbstractApplicationContext.java:929)
2018-05-14 11:31:35.642 [Thread-5] INFO  com.netflix.util.concurrent.ShutdownEnabledTimer - Shutdown hook removed for: NFLoadBalancer-PingTimer-dps-bl-api
2018-05-14 11:31:35.648 [Thread-5] INFO  com.netflix.util.concurrent.ShutdownEnabledTimer - Exception caught (might be ok if at shutdown)
java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.remove(Unknown Source)
        at java.lang.Runtime.removeShutdownHook(Unknown Source)
        at com.netflix.util.concurrent.ShutdownEnabledTimer.cancel(ShutdownEnabledTimer.java:70)
        at com.netflix.loadbalancer.BaseLoadBalancer.cancelPingTask(BaseLoadBalancer.java:613)
        at com.netflix.loadbalancer.BaseLoadBalancer.shutdown(BaseLoadBalancer.java:864)
        at com.netflix.loadbalancer.DynamicServerListLoadBalancer.shutdown(DynamicServerListLoadBalancer.java:285)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:364)
        at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:287)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:583)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:555)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:516)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1032)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1008)
        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:583)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:555)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:516)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1032)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1008)
        at org.springframework.context.support.AbstractApplicationContext$2.run(AbstractApplicationContext.java:929)

@dsyer
Copy link
Contributor

dsyer commented May 14, 2018

I wouldn't expect #2087 to affect this necessarily. We would need to move the @EventListener probably. I think the issue is mostly cosmetic though.

@deba70
Copy link

deba70 commented Sep 18, 2019

The issue still exist in Finchley.SR1. The issue seems cosmetic and you are shutting down the app but the side effect is severe. The issue is failing to send "STOP" request to eureka server; as a result the dead app instance will still be registered in Eureka server longer than it suppose to be.

Here is the line from the log..........
Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': 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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests