apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.4k stars 26.42k forks source link

经历2.7.8坑后,好不容易等来个2.7.9,结果升级整合报错,望指点指点 #7347

Closed pangshuqiang closed 3 years ago

pangshuqiang commented 3 years ago

环境: springboot:2.3.7.RELEASE springcloud:Hoxton.SR9 springcloudalibaba:2.2.5.RELEASE nacos:1.4.1

正常情况下,springcloudalibaba-2.2.5.RELEASE里自带的事2.7.8版本的Dubbo,该版本下项目是能运行OK。

由于小马哥告知有新版,所以想单独替换Dubbo为2.7.9,调整后内容如下: `

org.apache.dubbo dubbo-spring-boot-starter 2.7.8 org.apache.dubbo dubbo
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo</artifactId>
        <version>2.7.9</version>
    </dependency>

`

但是运行直接报错: `2021-03-09 15:14:48.913 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [referenceAnnotationBeanPostProcessor] has been registered. 2021-03-09 15:14:48.914 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [org.apache.dubbo.config.spring.beans.factory.annotation.DubboConfigAliasPostProcessor]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [dubboConfigAliasPostProcessor] has been registered. 2021-03-09 15:14:48.914 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [org.apache.dubbo.config.spring.context.DubboApplicationListenerRegistrar]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [dubboApplicationListenerRegister] has been registered. 2021-03-09 15:14:48.915 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [org.apache.dubbo.config.spring.beans.factory.config.DubboConfigDefaultPropertyValueBeanPostProcessor]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [dubboConfigDefaultPropertyValueBeanPostProcessor] has been registered. 2021-03-09 15:14:48.915 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [org.apache.dubbo.config.spring.beans.factory.config.DubboConfigEarlyInitializationPostProcessor]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [dubboConfigEarlyInitializationPostProcessor] has been registered. 2021-03-09 15:14:49.089 WARN 8364 --- [ main] o.s.b.a.e.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format. 2021-03-09 15:14:49.144 INFO 8364 --- [ main] .b.f.a.ConfigurationBeanBindingRegistrar : The configuration bean definition [name : org.apache.dubbo.config.ApplicationConfig#0, content : Root bean: class [org.apache.dubbo.config.ApplicationConfig]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] has been registered. 2021-03-09 15:14:49.144 INFO 8364 --- [ main] c.a.s.u.BeanRegistrar : The Infrastructure bean definition [Root bean: class [com.alibaba.spring.beans.factory.annotation.ConfigurationBeanBindingPostProcessor]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=nullwith name [configurationBeanBindingPostProcessor] has been registered. 2021-03-09 15:14:49.144 INFO 8364 --- [ main] .b.f.a.ConfigurationBeanBindingRegistrar : The configuration bean definition [name : org.apache.dubbo.config.RegistryConfig#0, content : Root bean: class [org.apache.dubbo.config.RegistryConfig]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] has been registered. 2021-03-09 15:14:49.145 INFO 8364 --- [ main] .b.f.a.ConfigurationBeanBindingRegistrar : The configuration bean definition [name : org.apache.dubbo.config.ProtocolConfig#0, content : Root bean: class [org.apache.dubbo.config.ProtocolConfig]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] has been registered. 2021-03-09 15:14:49.145 INFO 8364 --- [ main] .b.f.a.ConfigurationBeanBindingRegistrar : The configuration bean definition [name : org.apache.dubbo.config.ConsumerConfig#0, content : Root bean: class [org.apache.dubbo.config.ConsumerConfig]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] has been registered. 2021-03-09 15:14:49.152 INFO 8364 --- [ main] boConfigEarlyInitializationPostProcessor : BeanFactory is about to be initialized, trying to resolve the Dubbo Config Beans early initialization 2021-03-09 15:14:49.154 WARN 8364 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.apache.dubbo.config.spring.context.DubboLifecycleComponentApplicationListener: method ()V not found 2021-03-09 15:14:49.165 INFO 8364 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-03-09 15:14:49.176 ERROR 8364 --- [ main] o.s.b.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.apache.dubbo.config.spring.context.DubboLifecycleComponentApplicationListener: method ()V not found at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:119) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE] at com.weifor.dubbo.DubboApplication.main(DubboApplication.java:10) [classes/:?] Caused by: java.lang.NoSuchMethodError: org.apache.dubbo.config.spring.context.DubboLifecycleComponentApplicationListener: method ()V not found at org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration.setApplicationContext(DubboAutoConfiguration.java:83) ~[dubbo-spring-boot-autoconfigure-compatible-2.7.8.jar:2.7.8] at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:123) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:100) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE] ... 16 more

`

这个 Caused by: java.lang.NoSuchMethodError: org.apache.dubbo.config.spring.context.DubboLifecycleComponentApplicationListener: method <init>()V not found

是个啥?大神指点指点一下,谢谢!!

lucifer0x1 commented 3 years ago

version 2.7.9 package : org.apache.dubbo.config.spring.contex DubboLifecycleComponentApplicationListener.java line 54

public DubboLifecycleComponentApplicationListener(ApplicationContext applicationContext) {
    super(applicationContext);
}

这里个构造方法是有参数的, 那么就没有默认的无惨构造方法了,

在 2.7.8中没有上面的方法,所以有无参构造方法 临时解决办法 是在 DubboLifecycleComponentApplicationListener 加上无参构造方法

public DubboLifecycleComponentApplicationListener( ) {

}
pangshuqiang commented 3 years ago

version 2.7.9 package : org.apache.dubbo.config.spring.contex DubboLifecycleComponentApplicationListener.java line 54

public DubboLifecycleComponentApplicationListener(ApplicationContext applicationContext) {
    super(applicationContext);
}

这里个构造方法是有参数的, 那么就没有默认的无惨构造方法了,

在 2.7.8中没有上面的方法,所以有无参构造方法 临时解决办法 是在 DubboLifecycleComponentApplicationListener 加上无参构造方法

public DubboLifecycleComponentApplicationListener( ) {

}

谢谢~~

修改源码还真没玩过,也好给需要的同学指点思路,期待Dubbo后续的完善。

caohenghui commented 3 years ago

哥们已经打算弃坑了。越改问题越多;还不如停留在当当网那个版本

pangshuqiang commented 3 years ago

感谢及时出了 org-apache-dubbo-start-2.7.9,目前使用该版本启动正常,项目比之前稳定很多~~

AlbumenJ commented 3 years ago

最新版本 2.7.10 已经向前兼容旧版本 starter,同时对于的 2.7.10 的 starter 也已经发布(starter 暂不向前兼容 Dubbo)。关于启动问题的 2.7.9 版本 starter 已经发布。