Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dubbo 2.7.14 不兼容spring boot 2.6.1 #9394

Closed
LusiferCoder opened this issue Dec 13, 2021 · 7 comments · Fixed by #9426
Closed

dubbo 2.7.14 不兼容spring boot 2.6.1 #9394

LusiferCoder opened this issue Dec 13, 2021 · 7 comments · Fixed by #9426
Labels
type/bug Bugs to being fixed
Milestone

Comments

@LusiferCoder
Copy link

dubbo 2.7.14 不兼容spring boot 2.6.1,spring boot 2.5.x 一下兼容的,我升级到 spring boot 2.6.1 以后,dubbo 的健康检查就报错了

@LusiferCoder LusiferCoder added the type/bug Bugs to being fixed label Dec 13, 2021
@wangchengming666
Copy link
Member

@jinshengyong 可以贴一些异常信息吗

@LusiferCoder
Copy link
Author

版本

  • spring boot 2.6.1
  • spring cloud 2021.0.0
  • dubbo 2.7.14

报错信息


java.lang.IllegalStateException: Error processing condition on org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAnnotationAutoConfiguration.dubboEndpoint
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
	at org.apache.dubbo.spring.boot.actuate.endpoint.condition.CompatibleOnEnabledEndpointCondition.matches(CompatibleOnEnabledEndpointCondition.java:57)
	at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:193)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
	at cn.funtk.myshop.provider.ProviderApplication.main(ProviderApplication.java:19)
Caused by: java.util.NoSuchElementException: Unable to get attribute value for missing annotation
	at org.springframework.core.annotation.MissingMergedAnnotation.getAttributeValue(MissingMergedAnnotation.java:160)
	at org.springframework.core.annotation.AbstractMergedAnnotation.getRequiredAttributeValue(AbstractMergedAnnotation.java:217)
	at org.springframework.core.annotation.AbstractMergedAnnotation.getClass(AbstractMergedAnnotation.java:149)
	at org.springframework.boot.actuate.autoconfigure.endpoint.condition.OnAvailableEndpointCondition.getTarget(OnAvailableEndpointCondition.java:79)
	at org.springframework.boot.actuate.autoconfigure.endpoint.condition.OnAvailableEndpointCondition.getMatchOutcome(OnAvailableEndpointCondition.java:72)
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
	... 18 common frames omitted

@LusiferCoder
Copy link
Author

用以下版本就没问题

spring boot 2.5.7
spring cloud 2020.0.4
dubbo 2.7.14

@chickenlj chickenlj added this to the 3.0.6 milestone Dec 15, 2021
@gitchenjh
Copy link
Contributor

The root cause is that Spring Boot Actuator changed the implement of org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionOutcome#getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) in Spring Boot Actuator 2.6.x . It requires endpoint beans annotationed directly by org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint
1639624363(1)
The org.apache.dubbo.spring.boot.actuate.endpoint.condition.CompatibleOnEnabledEndpointCondition is not working with Spring Boot Actuator 2.6.x

根本原因是 Spring Boot Actuator 在 2.6.x 版本变更了org.springframework.boot.actuate.autoconfigure.endpoint.condition#ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata)的实现,现在 endpoint beans 必须直接被 org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint 注解修饰
org.apache.dubbo.spring.boot.actuate.endpoint.condition.CompatibleOnEnabledEndpointCondition 和 Spring Boot Actuator 2.6.x版本不兼容

@gitchenjh
Copy link
Contributor

Fixed in #9426

@icankeep
Copy link
Contributor

I tried and made a different mistake.

dubbo version: 3.0.4
spring boot version: 2.6.1
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:227)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:240)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
	at com.example.springboot.provider.ProviderApplication.main(ProviderApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.metrics.ApplicationStartup
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 5 more

@StringKe
Copy link

I tried and made a different mistake.

dubbo version: 3.0.4
spring boot version: 2.6.1
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:227)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:240)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
	at com.example.springboot.provider.ProviderApplication.main(ProviderApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.metrics.ApplicationStartup
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 5 more

@icankeep Is this problem solved? I also encountered the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants