dubbo
dubbo copied to clipboard
dubbo从2.7.8--->2.7.15后,启动报错
- 环境版本为
- spring boot 2.6.7、 jdk8、dubbo2.7.15,
- 尝试升级后,网上查询许久无果,报错堆栈如下,请问下该如何排查解决
Exception in thread "DubboShutdownHook" java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardDataSource' defined in class path resource [xxx/shard/ShardConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.common.shard.ShardDataSource]: Factory method 'shardDataSource' threw exception; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1bfe3203 has not been refreshed yet
at org.apache.dubbo.common.function.ThrowableAction.execute(ThrowableAction.java:48)
at org.apache.dubbo.common.lang.ShutdownHookCallbacks.lambda$callback$0(ShutdownHookCallbacks.java:70)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.apache.dubbo.common.lang.ShutdownHookCallbacks.callback(ShutdownHookCallbacks.java:70)
at org.apache.dubbo.config.DubboShutdownHook.callback(DubboShutdownHook.java:84)
at org.apache.dubbo.config.DubboShutdownHook.run(DubboShutdownHook.java:72)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardDataSource' defined in class path resource [xxx/bi/common/shard/ShardConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.common.shard.ShardDataSource]: Factory method 'shardDataSource' threw exception; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1bfe3203 has not been refreshed yet
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:264)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:221)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at org.apache.dubbo.config.spring.context.DubboBootstrapStartStopListenerSpringAdapter.onStop(DubboBootstrapStartStopListenerSpringAdapter.java:45)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.lambda$destroy$24(DubboBootstrap.java:1274)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.destroy(DubboBootstrap.java:1274)
at org.apache.dubbo.common.function.ThrowableAction.execute(ThrowableAction.java:46)
... 5 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.common.shard.ShardDataSource]: Factory method 'shardDataSource' threw exception; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1bfe3203 has not been refreshed yet
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 26 more
Caused by: java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1bfe3203 has not been refreshed yet
at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1141)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1153)
at com.xxx.common.shard.ShardConfig.shardDataSource(ShardConfig.java:48)
at com.xxx.common.shard.ShardConfig$$EnhancerBySpringCGLIB$$a1c0ba3.CGLIB$shardDataSource$2(<generated>)
at com.xxx.common.shard.ShardConfig$$EnhancerBySpringCGLIB$$a1c0ba3$$FastClassBySpringCGLIB$$dc14e65e.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.xxx.common.shard.ShardConfig$$EnhancerBySpringCGLIB$$a1c0ba3.shardDataSource(<generated>)
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:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 27 more
at org.apache.dubbo.config.DubboShutdownHook.run(DubboShutdownHook.java:72)
这个看起来应该在关闭流程了。至于具体报错应该是对应的 dataSource 处理关闭逻辑有问题。升级后 Dubbo 分发了 Spring 的消息。