openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12) OpenJDK 64-Bit Server VM GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12, mixed mode, sharing)
目前最新的GraalVM-CE版已经默认集成里native-image工具 可以用
1
sudo gu install native-image
验证或者安装
1 2 3
Downloading: Component catalog from www.graalvm.org Processing Component: Native Image Component Native Image (org.graalvm.native-image) is already installed.
Exception in thread "main" java.lang.IllegalStateException: No constructor or factory method candidate found for Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=singleton; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null and argument types [] at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorOrFactoryMethod(ConstructorResolver.java:944) at org.springframework.beans.factory.support.RegisteredBean.resolveConstructorOrFactoryMethod(RegisteredBean.java:209) at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.<init>(BeanDefinitionMethodGenerator.java:86) at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:100) at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:115) at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:48) at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:36) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44) at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58) at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67) at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53) at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106) at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84) at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49) at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82) at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for dubbo-samples-native-image 1.0-SNAPSHOT: [INFO] [INFO] dubbo-samples-native-image ......................... SUCCESS [ 0.241 s] [INFO] dubbo-samples-native-image-interface ............... SUCCESS [ 0.492 s] [INFO] dubbo-samples-native-image-provider ................ FAILURE [ 3.659 s] [INFO] dubbo-samples-native-image-consumer ................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.537 s [INFO] Finished at: 2023-07-16T22:24:41+08:00 [INFO] ------------------------------------------------------------------------
2023-07-16T23:17:40.712+08:00 INFO [dubbo-samples-nativeimage-provider,,] 5376 --- [ main] o.a.d.n.p.NativeDemoProviderApplication : Started NativeDemoProviderApplication in 0.348 seconds (process running for 0.359)
2023-07-16T23:20:32.967+08:00 INFO [dubbo-samples-nativeimage-provider,,] 5434 --- [ main] o.a.d.n.p.NativeDemoProviderApplication : Started NativeDemoProviderApplication in 1.933 seconds (process running for 2.203)