Dubbo---升级Dubbo2.7.13依赖问题
原文链接:https://blog.csdn.net/chihaihai/article/details/121937037
版本对应关系表:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
2021-12-14 18:42:54.401 WARN 9328 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'referenceAnnotationBeanPostProcessor': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.setClassValuesAsString(Z)V
2021-12-14 18:42:54.407 INFO 9328 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-14 18:42:54.419 ERROR 9328 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.<init>(ReferenceAnnotationBeanPostProcessor.java:106)
The following method did not exist:
org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.setClassValuesAsString(Z)V
The method's class, org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor, is available from the following locations:
jar:file:/F:/maven/repository/org/apache/dubbo/dubbo/2.7.13/dubbo-2.7.13.jar!/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.class
The class hierarchy was loaded from the following locations:
org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor: file:/F:/maven/repository/org/apache/dubbo/dubbo/2.7.13/dubbo-2.7.13.jar
com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor: file:/F:/maven/repository/com/alibaba/spring/spring-context-support/1.0.10/spring-context-support-1.0.10.jar
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter: file:/F:/maven/repository/org/springframework/spring-beans/5.2.15.RELEASE/spring-beans-5.2.15.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor
被这个坑卡了好久,一直以为是依赖冲突问题。改了无数个版本都不行,最终终于在ghihub,spring-cloud-alibaba
issues中找到了答案:https://github.com/alibaba/spring-cloud-alibaba/issues/2310
单独添加依赖:
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.11</version>
</dependency>