zyro23 / grails-spring-websocket

93 stars 28 forks source link

Trying to upgrade from 3.0.11 to 3.2.0 and get this error... #41

Closed virtualdogbert closed 7 years ago

virtualdogbert commented 7 years ago

So I'm trying to upgrade to 3.2 from 3.0.11, but I get and error about webSocketMessageBrokerStats which ends up being Caused by: java.lang.IllegalStateException: ThreadPoolTaskExecutor not initialized. Any Ideas what could be causing this or a possible workaround?

2016-10-03 14:26:02,789 [main] ERROR org.springframework.boot.SpringApplication reportFailure | Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketMessageBrokerStats' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.config.WebSocketMessageBrokerStats]: Factory method 'webSocketMessageBrokerStats' threw exception; nested exception is java.lang.IllegalStateException: ThreadPoolTaskExecutor not initialized at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) at grails.boot.GrailsApp.run(GrailsApp.groovy:55) at grails.boot.GrailsApp.run(GrailsApp.groovy:374) at grails.boot.GrailsApp.run(GrailsApp.groovy:363) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232) at exaservice.Application.main(Application.groovy:18) Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.socket.config.WebSocketMessageBrokerStats]: Factory method 'webSocketMessageBrokerStats' threw exception; nested exception is java.lang.IllegalStateException: ThreadPoolTaskExecutor not initialized at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) Disconnected from the target VM, address: '127.0.0.1:60946', transport: 'socket' ... 20 common frames omitted Caused by: java.lang.IllegalStateException: ThreadPoolTaskExecutor not initialized at org.springframework.util.Assert.state(Assert.java:392) at org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.getThreadPoolExecutor(ThreadPoolTaskExecutor.java:260) at org.springframework.web.socket.config.WebSocketMessageBrokerStats.setInboundChannelExecutor(WebSocketMessageBrokerStats.java:96) at org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.webSocketMessageBrokerStats(WebSocketMessageBrokerConfigurationSupport.java:126) 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:497) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ... 21 common frames omitted

Process finished with exit code 1

zyro23 commented 7 years ago

had some dicsussion in slack, however still unable to reproduce. sample-app with a reproducible example would be appreciated. thanks!

virtualdogbert commented 7 years ago

After a lot of debugging I finally stumbled on the Issue the WebSocketConfig had an @Configuration annotation, that combined with the component scan and the reference from resources.groovy, caused weird things to happen. This is the second time during this upgrade I've looked at the code, and wondered how it ever worked in the first place.