Native-image base springNative and Dubbo build failure

aiazj4mn  于 2022-11-13  发布在  Spring
关注(0)|答案(5)|浏览(174)
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.9
  • Operating System version: windows 10
  • Java version: 1.8.0_282
  • OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 25.282-b07-jvmci-21.0-b06, mixed mode)
  • spring-aot-maven-plugin version 0.9.2
  • springNative 0.9.2
  • native-image-maven-plugin 21.1.0
  • spring-boot-starter-parent 2.4.5

Steps to reproduce this issue

  1. graalvm native-image build dubbo application
  2. I get error messages when I start build,It may be caused by Dubbo autoconfig

Pls. provide [GitHub address] to reproduce this issue.
The sample code is https://github.com/jack161641/gs-rest-service.git

Expected Result

build success
What do you expected from the above steps?

Actual Result

build failure
What actually happens?
build failure
If there is an exception, please attach the exception trace:

java.lang.NullPointerException: null
at org.apache.dubbo.config.bootstrap.DubboBootstrap.hasExportedServices(DubboBootstrap.java:937) ~[dubbo-2.7.9.jar:2.7.9]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:899) ~[dubbo-2.7.9.jar:2.7.9]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:62) ~[dubbo-2.7.9.jar:2.7.9]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:55) ~[dubbo-2.7.9.jar:2.7.9]
at com.alibaba.spring.context.OnceApplicationContextEventListener.onApplicationEvent(OnceApplicationContextEventListener.java:52) ~[spring-context-support-1.0.10.jar:na]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-2.4.5.jar:2.4.5]
Just put your stack trace here!

holgip5t

holgip5t1#

pls config metadata-config address using ip+port and try.

taor4pac

taor4pac2#

pls config metadata-config address using ip+port and try.

The dubbo api config is ,It may be caused by Graalvm not support reflection
configCenterConfig.setAddress("172.16.3.100");
configCenterConfig.setPort(2181);

wvyml7n5

wvyml7n53#

at org.apache.dubbo.config.bootstrap.DubboBootstrap.hasExportedServices maybe metadata-report error.

in my opinion, you should ensure dubbo applicant run successfully, and then use Graalvm build dubbo applicantion.

c3frrgcw

c3frrgcw4#

at org.apache.dubbo.config.bootstrap.DubboBootstrap.hasExportedServices maybe metadata-report error.

in my opinion, you should ensure dubbo applicant run successfully, and then use Graalvm build dubbo applicantion.

Yes, I solved this problem because I lacked dependencies. Now the build is successful, but an error is reported when running

[admin@izuf6iqbgyn5z3cczptzb3z complete]$ ./target/com.example.restservice.restserviceapplication 2021-05-14 14:06:57.917 ERROR 2160 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang.ExceptionInInitializerError: null at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.buildBannerText(WelcomeLogoApplicationListener.java:79) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.onApplicationEvent(WelcomeLogoApplicationListener.java:60) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.onApplicationEvent(WelcomeLogoApplicationListener.java:41) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[na:na] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[na:na] at java.util.ArrayList.forEach(ArrayList.java:1259) ~[com.example.restservice.restserviceapplication:na] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[na:na] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[na:na] at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[na:na] at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [com.example.restservice.restserviceapplication:2.4.5] at com.example.restservice.RestServiceApplication.main(RestServiceApplication.java:14) [com.example.restservice.restserviceapplication:0.0.1-SNAPSHOT] Caused by: java.lang.NullPointerException: null at org.apache.dubbo.common.logger.LoggerFactory.lambda$getLogger$0(LoggerFactory.java:111) ~[na:na] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:na] at org.apache.dubbo.common.logger.LoggerFactory.getLogger(LoggerFactory.java:111) ~[na:na] at org.apache.dubbo.common.Version.<clinit>(Version.java:39) ~[na:na] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375) ~[na:na] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295) ~[na:na] ... 18 common frames omitted
The reproduce is https://github.com/jack161641/gs-rest-service.git

nbysray5

nbysray55#

at org.apache.dubbo.config.bootstrap.DubboBootstrap.hasExportedServices maybe metadata-report error.
in my opinion, you should ensure dubbo applicant run successfully, and then use Graalvm build dubbo applicantion.

Yes, I solved this problem because I lacked dependencies. Now the build is successful, but an error is reported when running

[admin@izuf6iqbgyn5z3cczptzb3z complete]$ ./target/com.example.restservice.restserviceapplication 2021-05-14 14:06:57.917 ERROR 2160 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang.ExceptionInInitializerError: null at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.buildBannerText(WelcomeLogoApplicationListener.java:79) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.onApplicationEvent(WelcomeLogoApplicationListener.java:60) ~[na:na] at org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener.onApplicationEvent(WelcomeLogoApplicationListener.java:41) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[na:na] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[na:na] at java.util.ArrayList.forEach(ArrayList.java:1259) ~[com.example.restservice.restserviceapplication:na] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[na:na] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[na:na] at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[na:na] at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) [com.example.restservice.restserviceapplication:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [com.example.restservice.restserviceapplication:2.4.5] at com.example.restservice.RestServiceApplication.main(RestServiceApplication.java:14) [com.example.restservice.restserviceapplication:0.0.1-SNAPSHOT] Caused by: java.lang.NullPointerException: null at org.apache.dubbo.common.logger.LoggerFactory.lambda$getLogger$0(LoggerFactory.java:111) ~[na:na] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:na] at org.apache.dubbo.common.logger.LoggerFactory.getLogger(LoggerFactory.java:111) ~[na:na] at org.apache.dubbo.common.Version.<clinit>(Version.java:39) ~[na:na] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375) ~[na:na] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295) ~[na:na] ... 18 common frames omitted
The reproduce is https://github.com/jack161641/gs-rest-service.git

Sorry, dubbo's integration with Native-image is still under discussion, you can subscribe to the dev@dubbo.apache.org mailing group and follow it. You are welcome to give suggestions on the combination of dubbo and Native-image.

相关问题