apache / dubbo

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

[Bug] The application built using native image failed to start.I need to manually modify reflect-config. json of application.dubbo version: 3.3.0-beta.2 #14147

Open imgoby opened 4 months ago

imgoby commented 4 months ago

Pre-check

Search before asking

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

3.3.0-beta.2

Steps to reproduce this issue

  1. check out the sub project source: https://github.com/imgoby/spring-cloud-alibaba-dubbo-native
  2. mvn clean package native:compile
  3. enter sub project: cd dubbo-samples-native-image-registry-provider
  4. cd target
  5. run: ./dubbo-spring-boot-zookeeper-provider

What you expected to happen

Run without Exception.

Anything else

2024-04-30T15:52:25.550+08:00  INFO 31307 --- [           main] .DubboRegistryZooKeeperProviderBootstrap : Starting AOT-processed DubboRegistryZooKeeperProviderBootstrap using Java 17.0.11 with PID 31307 (/root/spring-cloud-alibaba-dubbo-native/dubbo-spring-boot-zookeeper-provider/target/dubbo-spring-boot-zookeeper-provider started by root in /root/spring-cloud-alibaba-dubbo-native/dubbo-spring-boot-zookeeper-provider/target)
2024-04-30T15:52:25.550+08:00  INFO 31307 --- [           main] .DubboRegistryZooKeeperProviderBootstrap : No active profile set, falling back to 1 default profile: "default"
2024-04-30T15:52:25.552+08:00  WARN 31307 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAnnotationBeanProcessor': Instantiation of supplied bean failed
2024-04-30T15:52:25.552+08:00 ERROR 31307 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAnnotationBeanProcessor': Instantiation of supplied bean failed
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1220) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:138) ~[na:na]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:771) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:589) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[dubbo-spring-boot-zookeeper-provider:3.0.9]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[dubbo-spring-boot-zookeeper-provider:3.0.9]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[dubbo-spring-boot-zookeeper-provider:3.0.9]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[dubbo-spring-boot-zookeeper-provider:3.0.9]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150) ~[na:na]
    at org.apache.dubbo.spring.boot.sample.provider.bootstrap.DubboRegistryZooKeeperProviderBootstrap.main(DubboRegistryZooKeeperProviderBootstrap.java:34) ~[dubbo-spring-boot-zookeeper-provider:na]
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.apache.dubbo.config.spring6.beans.factory.annotation.ServiceAnnotationWithAotPostProcessor.<init>(java.util.Collection)
    at org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration.serviceAnnotationBeanProcessor(DubboAutoConfiguration.java:74) ~[dubbo-spring-boot-zookeeper-provider:na]
    at org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration__BeanDefinitions.lambda$getServiceAnnotationBeanProcessorInstanceSupplier$0(DubboAutoConfiguration__BeanDefinitions.java:31) ~[na:na]
    at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:202) ~[na:na]
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:214) ~[na:na]
    at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:202) ~[na:na]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[dubbo-spring-boot-zookeeper-provider:6.0.11]
    ... 16 common frames omitted
Caused by: java.lang.NoSuchMethodException: org.apache.dubbo.config.spring6.beans.factory.annotation.ServiceAnnotationWithAotPostProcessor.<init>(java.util.Collection)
    at java.base@17.0.11/java.lang.Class.checkMethod(DynamicHub.java:1042) ~[dubbo-spring-boot-zookeeper-provider:na]
    at java.base@17.0.11/java.lang.Class.getConstructor0(DynamicHub.java:1208) ~[dubbo-spring-boot-zookeeper-provider:na]
    at java.base@17.0.11/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2754) ~[dubbo-spring-boot-zookeeper-provider:na]
    at org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration.serviceAnnotationBeanProcessor(DubboAutoConfiguration.java:71) ~[dubbo-spring-boot-zookeeper-provider:na]
    ... 26 common frames omitted

Are you willing to submit a pull request to fix on your own?

Code of Conduct

CrazyHZM commented 3 months ago

@imgoby The problem cannot be reproduced using the above steps. Please provide the correct samples and steps.