apache / apache/dubbo

dubbo从2.7.8--->2.7.15后,启动报错

Open
#10,655 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

- 环境版本为
- 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()
at com.xxx.common.shard.ShardConfig$$EnhancerBySpringCGLIB$$a1c0ba3$$FastClassBySpringCGLIB$$dc14e65e.invoke()
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()
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
```

Contributor guide

Open the contributing guide

Research direction

Start with the stack trace entry point com.xxx.common.shard.ShardConfig.shardDataSource at line 48, then trace the shutdown path through DubboShutdownHook and DubboBootstrap.destroy. Reproduce the startup failure with Spring Boot 2.6.7, JDK 8, and Dubbo 2.7.15, and compare against 2.7.8; done means identifying a minimal reproducible cause and a confirmed fix or compatibility guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.