alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.82k stars 8.31k forks source link

Springboot3 native compile nacos config refresh listener connect failed. #3219

Closed javawcy closed 1 year ago

javawcy commented 1 year ago

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。另外请按照如下要求提交相关信息节省社区维护同学的理解成本,否则该讨论极有可能直接被忽视或关闭。 We recommend using English. If you are non-native English speaker, you can use the translation software. We recommend using English. If you are non-native English speaker, you can use the translation software. In addition, please submit relevant information according to the following requirements to save the understanding cost of community maintenances, otherwise the discussion is very likely to be ignored or closed directly.

Which Component Nacos config

Describe the bug Use springboot-3.0.4,spring-cloud-alibaba-2022.0.0.0-RC1,spring-cloud-2022.0.1,mse-nacos-config-server-2.1.0.2 on aliyun It's ok with nacos config get&refresh before native compile, but after native compile it goes wrong refresh config, i was ensure the port 8848&9848 is all right open. here is my demo log demo git:(master) ✗ ./mvnw -Pnative native:compile [INFO] Scanning for projects... [INFO] [INFO] --------------------------< com.example:demo >-------------------------- [INFO] Building demo 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] >>> native-maven-plugin:0.9.20:compile (default-cli) > package @ demo >>> [INFO] [INFO] --- native-maven-plugin:0.9.20:add-reachability-metadata (add-reachability-metadata) @ demo --- [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory not found. Trying latest version. [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory is ch.qos.logback/logback-classic/1.4.1 [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.5]: Configuration directory not found. Trying latest version. [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.5]: Configuration directory is org.apache.tomcat.embed/tomcat-embed-core/10.0.20 [INFO] [INFO] --- maven-resources-plugin:3.3.0:resources (default-resources) @ demo --- [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ demo --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/mac/Desktop/demo/target/classes [INFO] [INFO] --- maven-resources-plugin:3.3.0:testResources (default-testResources) @ demo --- [INFO] skip non existing resourceDirectory /Users/mac/Desktop/demo/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ demo --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/mac/Desktop/demo/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running com.example.demo.DemoApplicationTests 16:13:55.427 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [DemoApplicationTests]: using SpringBootContextLoader 16:13:55.431 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.demo.DemoApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}. 16:13:55.432 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.demo.DemoApplicationTests]: DemoApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 16:13:55.464 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using ContextCustomizers for test class [DemoApplicationTests]: [ExcludeFilterContextCustomizer, DuplicateJsonObjectContextCustomizer, MockitoContextCustomizer, TestRestTemplateContextCustomizer, DisableObservabilityContextCustomizer, PropertyMappingContextCustomizer, Customizer] 16:13:55.545 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/mac/Desktop/demo/target/classes/com/example/demo/DemoApplication.class] 16:13:55.550 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.demo.DemoApplication for test class com.example.demo.DemoApplicationTests 16:13:55.658 [main] DEBUG org.springframework.test.context.util.TestContextSpringFactoriesUtils - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom TestExecutionListener classes or make the default TestExecutionListener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource] 16:13:55.660 [main] DEBUG org.springframework.test.context.util.TestContextSpringFactoriesUtils - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom TestExecutionListener classes or make the default TestExecutionListener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute] 16:13:55.665 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners for test class [DemoApplicationTests]: [ServletTestExecutionListener, DirtiesContextBeforeModesTestExecutionListener, ApplicationEventsTestExecutionListener, MockitoTestExecutionListener, DependencyInjectionTestExecutionListener, DirtiesContextTestExecutionListener, EventPublishingTestExecutionListener, ResetMocksTestExecutionListener, RestDocsTestExecutionListener, MockRestServiceServerResetTestExecutionListener, MockMvcPrintOnlyOnFailureTestExecutionListener, WebDriverTestExecutionListener, MockWebServiceServerTestExecutionListener] 16:13:55.668 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: class [DemoApplicationTests], class annotated with @DirtiesContext [false] with mode [null] 2023-03-20T16:13:57.606+08:00 WARN 41832 --- [ main] c.a.nacos.client.logging.NacosLogging : Load Logback Configuration of Nacos fail, message: org/slf4j/impl/StaticLoggerBinder

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v3.0.4)

2023-03-20T16:13:57.667+08:00 INFO 41832 --- [ main] com.example.demo.DemoApplicationTests : Starting DemoApplicationTests using Java 17.0.5 with PID 41832 (started by mac in /Users/mac/Desktop/demo) 2023-03-20T16:13:57.668+08:00 INFO 41832 --- [ main] com.example.demo.DemoApplicationTests : No active profile set, falling back to 1 default profile: "default" 2023-03-20T16:13:57.697+08:00 INFO 41832 --- [ main] c.a.c.n.c.NacosConfigDataLoader : [Nacos Config] Load config[dataId=test-application.yml, group=DEFAULT_GROUP] success 2023-03-20T16:13:58.367+08:00 INFO 41832 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=b25ee030-3cd6-3f52-afb4-640e99edf814 2023-03-20T16:13:58.990+08:00 INFO 41832 --- [ main] com.example.demo.DemoApplicationTests : Started DemoApplicationTests in 3.226 seconds (process running for 4.259) xxxx xxxx 2023-03-20T16:13:58.998+08:00 INFO 41832 --- [ main] c.a.nacos.client.config.impl.CacheData : nacos.cache.data.init.snapshot = true 2023-03-20T16:13:58.999+08:00 INFO 41832 --- [ main] c.a.n.client.config.impl.ClientWorker : [fixed-yst-new-test-mse-a6519070-nacos-ans.mse.aliyuncs.com_8848] [subscribe] test-application.yml+DEFAULT_GROUP+yst-new-test 2023-03-20T16:13:59.010+08:00 INFO 41832 --- [ main] c.a.nacos.client.config.impl.CacheData : [fixed-yst-new-test-mse-a6519070-nacos-ans.mse.aliyuncs.com_8848] [add-listener] ok, tenant=yst-new-test, dataId=test-application.yml, group=DEFAULT_GROUP, cnt=1 2023-03-20T16:13:59.011+08:00 INFO 41832 --- [ main] c.a.c.n.refresh.NacosContextRefresher : [Nacos Config] Listening config: dataId=test-application.yml, group=DEFAULT_GROUP [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.289 s - in com.example.demo.DemoApplicationTests 2023-03-20T16:13:59.549+08:00 WARN 41832 --- [ Thread-1] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient 2023-03-20T16:13:59.549+08:00 WARN 41832 --- [ Thread-6] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher 2023-03-20T16:13:59.549+08:00 WARN 41832 --- [ Thread-6] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end 2023-03-20T16:13:59.550+08:00 WARN 41832 --- [ Thread-1] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] --- spring-boot-maven-plugin:3.0.4:process-aot (process-aot) @ demo --- 2023-03-20T16:14:02.321+08:00 WARN 41847 --- [ main] c.a.nacos.client.logging.NacosLogging : Load Logback Configuration of Nacos fail, message: org/slf4j/impl/StaticLoggerBinder

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v3.0.4)

2023-03-20T16:14:02.386+08:00 INFO 41847 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 17.0.5 with PID 41847 (/Users/mac/Desktop/demo/target/classes started by mac in /Users/mac/Desktop/demo) 2023-03-20T16:14:02.387+08:00 INFO 41847 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" 2023-03-20T16:14:02.437+08:00 INFO 41847 --- [ main] c.a.c.n.c.NacosConfigDataLoader : [Nacos Config] Load config[dataId=test-application.yml, group=DEFAULT_GROUP] success 2023-03-20T16:14:03.076+08:00 INFO 41847 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=5dab1cab-9c62-3987-95c3-136196243588 2023-03-20T16:14:03.973+08:00 WARN 41847 --- [ Thread-1] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient 2023-03-20T16:14:03.973+08:00 WARN 41847 --- [ Thread-6] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher 2023-03-20T16:14:03.973+08:00 WARN 41847 --- [ Thread-6] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end 2023-03-20T16:14:03.974+08:00 WARN 41847 --- [ Thread-1] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end [INFO] [INFO] --- maven-jar-plugin:3.3.0:jar (default-jar) @ demo --- [INFO] Building jar: /Users/mac/Desktop/demo/target/demo-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- spring-boot-maven-plugin:3.0.4:repackage (repackage) @ demo --- [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] <<< native-maven-plugin:0.9.20:compile (default-cli) < package @ demo <<< [INFO] [INFO] [INFO] --- native-maven-plugin:0.9.20:compile (default-cli) @ demo --- [INFO] Found GraalVM installation from JAVA_HOME variable. [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory not found. Trying latest version. [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.4.5]: Configuration directory is ch.qos.logback/logback-classic/1.4.1 [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/common/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/buffer/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/transport/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/handler/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/codec-http/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [WARNING] Properties file at 'jar:file:///Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar!/META-INF/native-image/io.netty/codec-http2/native-image.properties' does not match the recommended 'META-INF/native-image/com.alibaba.nacos/nacos-client/native-image.properties' layout. [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.5]: Configuration directory not found. Trying latest version. [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.5]: Configuration directory is org.apache.tomcat.embed/tomcat-embed-core/10.0.20 [INFO] Executing: /Users/mac/.sdkman/candidates/java/current/bin/native-image -cp /Users/mac/Desktop/demo/target/classes:/Users/mac/.m2/repository/org/springframework/boot/spring-boot/3.0.4/spring-boot-3.0.4.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-starter-json/3.0.4/spring-boot-starter-json-3.0.4.jar:/Users/mac/.m2/repository/org/springframework/spring-beans/6.0.6/spring-beans-6.0.6.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.14.2/jackson-datatype-jsr310-2.14.2.jar:/Users/mac/.m2/repository/io/micrometer/micrometer-observation/1.10.4/micrometer-observation-1.10.4.jar:/Users/mac/.m2/repository/ch/qos/logback/logback-classic/1.4.5/logback-classic-1.4.5.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.14.2/jackson-databind-2.14.2.jar:/Users/mac/.m2/repository/com/alibaba/nacos/nacos-auth-plugin/2.2.1-RC/nacos-auth-plugin-2.2.1-RC.jar:/Users/mac/.m2/repository/org/springframework/cloud/spring-cloud-commons/4.0.1/spring-cloud-commons-4.0.1.jar:/Users/mac/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar:/Users/mac/.m2/repository/org/apache/logging/log4j/log4j-api/2.19.0/log4j-api-2.19.0.jar:/Users/mac/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/10.1.5/tomcat-embed-websocket-10.1.5.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.0.4/spring-boot-autoconfigure-3.0.4.jar:/Users/mac/.m2/repository/org/apache/httpcomponents/httpcore/4.4.16/httpcore-4.4.16.jar:/Users/mac/.m2/repository/org/springframework/cloud/spring-cloud-context/4.0.1/spring-cloud-context-4.0.1.jar:/Users/mac/.m2/repository/org/springframework/spring-jcl/6.0.6/spring-jcl-6.0.6.jar:/Users/mac/.m2/repository/com/alibaba/nacos/nacos-encryption-plugin/2.2.1-RC/nacos-encryption-plugin-2.2.1-RC.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-starter-web/3.0.4/spring-boot-starter-web-3.0.4.jar:/Users/mac/.m2/repository/com/alibaba/nacos/nacos-client/2.2.1-RC/nacos-client-2.2.1-RC.jar:/Users/mac/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.5/tomcat-embed-el-10.1.5.jar:/Users/mac/.m2/repository/org/springframework/spring-expression/6.0.6/spring-expression-6.0.6.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.14.2/jackson-annotations-2.14.2.jar:/Users/mac/.m2/repository/io/micrometer/micrometer-commons/1.10.4/micrometer-commons-1.10.4.jar:/Users/mac/.m2/repository/org/springframework/spring-aop/6.0.6/spring-aop-6.0.6.jar:/Users/mac/.m2/repository/org/slf4j/jul-to-slf4j/2.0.6/jul-to-slf4j-2.0.6.jar:/Users/mac/.m2/repository/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.jar:/Users/mac/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.1.5/tomcat-embed-core-10.1.5.jar:/Users/mac/.m2/repository/io/prometheus/simpleclient_tracer_otel_agent/0.16.0/simpleclient_tracer_otel_agent-0.16.0.jar:/Users/mac/.m2/repository/io/prometheus/simpleclient_tracer_common/0.16.0/simpleclient_tracer_common-0.16.0.jar:/Users/mac/.m2/repository/io/prometheus/simpleclient/0.16.0/simpleclient-0.16.0.jar:/Users/mac/.m2/repository/io/prometheus/simpleclient_tracer_otel/0.16.0/simpleclient_tracer_otel-0.16.0.jar:/Users/mac/.m2/repository/ch/qos/logback/logback-core/1.4.5/logback-core-1.4.5.jar:/Users/mac/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/Users/mac/.m2/repository/com/alibaba/cloud/spring-cloud-alibaba-commons/2022.0.0.0-RC1/spring-cloud-alibaba-commons-2022.0.0.0-RC1.jar:/Users/mac/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.16/httpcore-nio-4.4.16.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-starter-logging/3.0.4/spring-boot-starter-logging-3.0.4.jar:/Users/mac/.m2/repository/org/springframework/security/spring-security-crypto/6.0.2/spring-security-crypto-6.0.2.jar:/Users/mac/.m2/repository/org/springframework/spring-webmvc/6.0.6/spring-webmvc-6.0.6.jar:/Users/mac/.m2/repository/com/alibaba/cloud/spring-cloud-starter-alibaba-nacos-config/2022.0.0.0-RC1/spring-cloud-starter-alibaba-nacos-config-2022.0.0.0-RC1.jar:/Users/mac/.m2/repository/org/springframework/spring-context/6.0.6/spring-context-6.0.6.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.14.2/jackson-datatype-jdk8-2.14.2.jar:/Users/mac/.m2/repository/com/alibaba/spring/spring-context-support/1.0.11/spring-context-support-1.0.11.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.14.2/jackson-module-parameter-names-2.14.2.jar:/Users/mac/.m2/repository/org/springframework/spring-web/6.0.6/spring-web-6.0.6.jar:/Users/mac/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.19.0/log4j-to-slf4j-2.19.0.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/3.0.4/spring-boot-starter-tomcat-3.0.4.jar:/Users/mac/.m2/repository/org/apache/httpcomponents/httpclient/4.5.14/httpclient-4.5.14.jar:/Users/mac/.m2/repository/org/springframework/boot/spring-boot-starter/3.0.4/spring-boot-starter-3.0.4.jar:/Users/mac/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar:/Users/mac/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.14.2/jackson-core-2.14.2.jar:/Users/mac/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.5/httpasyncclient-4.1.5.jar:/Users/mac/.m2/repository/org/springframework/spring-core/6.0.6/spring-core-6.0.6.jar --no-fallback -H:Path=/Users/mac/Desktop/demo/target -H:Name=demo -H:ConfigurationFileDirectories=/Users/mac/Desktop/demo/target/graalvm-reachability-metadata/b365fc76a8aeac7ac69a19eb164b374e98ce11ca/ch.qos.logback/logback-classic/1.4.1,/Users/mac/Desktop/demo/target/graalvm-reachability-metadata/b365fc76a8aeac7ac69a19eb164b374e98ce11ca/org.apache.tomcat.embed/tomcat-embed-core/10.0.20

GraalVM Native Image: Generating 'demo' (executable)...

Warning: Could not resolve io.netty.channel.socket.nio.NioServerSocketChannel for reflection configuration. Reason: java.lang.ClassNotFoundException: io.netty.channel.socket.nio.NioServerSocketChannel. [1/7] Initializing... (12.5s @ 0.31GB) Version info: 'GraalVM 22.3.0 Java 17 CE' Java version info: '17.0.5+8-jvmci-22.3-b08' C compiler: cc (apple, x86_64, 14.0.0) Garbage collector: Serial GC 1 user-specific feature(s)

2023-03-20T16:32:04.198+08:00 INFO 42905 --- [ main] com.example.demo.DemoApplication : Starting AOT-processed DemoApplication using Java 17.0.5 with PID 42905 (/Users/mac/Desktop/demo/target/demo started by mac in /Users/mac/Desktop/demo) 2023-03-20T16:32:04.198+08:00 INFO 42905 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" 2023-03-20T16:32:04.198+08:00 INFO 42905 --- [ main] c.a.c.n.c.NacosConfigDataLoader : [Nacos Config] Load config[dataId=test-application.yml, group=DEFAULT_GROUP] success 2023-03-20T16:32:04.200+08:00 INFO 42905 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=85187eca-b553-3d7f-bec7-851e0274d50c 2023-03-20T16:32:04.220+08:00 INFO 42905 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2023-03-20T16:32:04.221+08:00 INFO 42905 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2023-03-20T16:32:04.221+08:00 INFO 42905 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.5] 2023-03-20T16:32:04.229+08:00 INFO 42905 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2023-03-20T16:32:04.229+08:00 INFO 42905 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 31 ms 2023-03-20T16:32:04.285+08:00 INFO 42905 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2023-03-20T16:32:04.288+08:00 INFO 42905 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 0.524 seconds (process running for 0.54) xxxx xxxx 2023-03-20T16:32:04.289+08:00 INFO 42905 --- [ main] c.a.nacos.client.config.impl.CacheData : nacos.cache.data.init.snapshot = true 2023-03-20T16:32:04.289+08:00 INFO 42905 --- [ main] c.a.n.client.config.impl.ClientWorker : [fixed-yst-new-test-mse-a6519070-nacos-ans.mse.aliyuncs.com_8848] [subscribe] test-application.yml+DEFAULT_GROUP+yst-new-test 2023-03-20T16:32:04.289+08:00 INFO 42905 --- [ main] c.a.nacos.client.config.impl.CacheData : [fixed-yst-new-test-mse-a6519070-nacos-ans.mse.aliyuncs.com_8848] [add-listener] ok, tenant=yst-new-test, dataId=test-application.yml, group=DEFAULT_GROUP, cnt=1 2023-03-20T16:32:04.289+08:00 INFO 42905 --- [ main] c.a.c.n.refresh.NacosContextRefresher : [Nacos Config] Listening config: dataId=test-application.yml, group=DEFAULT_GROUP 2023-03-20T16:32:04.393+08:00 ERROR 42905 --- [s.client.Worker] com.alibaba.nacos.common.remote.client : Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=a84da4e4ee760d2d808e460896918730, Client-RequestTS=1679301124289, exConfigInfo=true, Spas-AccessKey=LTAI5tLPg7ziZ5D7dsngZCiY, Spas-Signature=ukUr6tGeoo+EyifDRROLK6ahDls=, Timestamp=1679301124289}, requestId='null'}, retryTimes = 0, errorMessage = Client not connected, current status:STARTING 2023-03-20T16:32:04.498+08:00 ERROR 42905 --- [s.client.Worker] com.alibaba.nacos.common.remote.client : Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=a84da4e4ee760d2d808e460896918730, Client-RequestTS=1679301124289, exConfigInfo=true, Spas-AccessKey=LTAI5tLPg7ziZ5D7dsngZCiY, Spas-Signature=ukUr6tGeoo+EyifDRROLK6ahDls=, Timestamp=1679301124289}, requestId='null'}, retryTimes = 1, errorMessage = Client not connected, current status:STARTING 2023-03-20T16:32:04.601+08:00 ERROR 42905 --- [s.client.Worker] com.alibaba.nacos.common.remote.client : Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=a84da4e4ee760d2d808e460896918730, Client-RequestTS=1679301124289, exConfigInfo=true, Spas-AccessKey=LTAI5tLPg7ziZ5D7dsngZCiY, Spas-Signature=ukUr6tGeoo+EyifDRROLK6ahDls=, Timestamp=1679301124289}, requestId='null'}, retryTimes = 2, errorMessage = Client not connected, current status:STARTING 2023-03-20T16:32:04.601+08:00 ERROR 42905 --- [s.client.Worker] c.a.n.client.config.impl.ClientWorker : Async listen config change error

com.alibaba.nacos.api.exception.NacosException: Client not connected, current status:STARTING at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:639) ~[demo:na] at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:1011) ~[na:na] at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:992) ~[na:na] at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.executeConfigListen(ClientWorker.java:785) ~[na:na] at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.lambda$startInternal$2(ClientWorker.java:703) ~[na:na] at java.base@17.0.5/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na] at java.base@17.0.5/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[demo:na] at java.base@17.0.5/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base@17.0.5/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[demo:na] at java.base@17.0.5/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na] at java.base@17.0.5/java.lang.Thread.run(Thread.java:833) ~[demo:na] at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) ~[demo:na] at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203) ~[na:na]

Simplest demo https://github.com/javawcy/nacos-bug-demo

To Reproduce Steps to reproduce the behavior: 1.replace nacos config in application.yml 2.add a string config named xxx in nacos,dataId=xxx.yml 3.use mvn wrapper & native compile then you will see this error

Additional context Add any other context about the problem here. MacOS,GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08),springboot-3.0.4,spring-cloud-alibaba-2022.0.0.0-RC1,spring-cloud-2022.0.1,mse-nacos-config-server-2.1.0.2 on aliyun

PorcoRosso5 commented 1 year ago

same error with you, waiting ...

yuluo-yx commented 1 year ago

Please refer to the component version and try again. https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E

yuluo-yx commented 1 year ago

If you are deploying nacos using docker, map port 9848 as well. Because nacos2.2.0 adds grpc communication. Otherwise, If you are deploying Nacos using Docker, map Port 9848 as well. Because Nacos2.2.0 adds GRPC communication. Otherwise, the connection cannot be initialized. See #6154

steverao commented 1 year ago

From your error report informations of below:

java.lang.NullPointerException: inStream parameter is null
at java.base@17.0.5/java.util.Objects.requireNonNull(Objects.java:233)
at java.base@17.0.5/java.util.Properties.load(Properties.java:407)
at com.alibaba.nacos.common.utils.VersionUtils.(VersionUtils.java:45)
at com.alibaba.nacos.client.utils.ParamUtil.(ParamUtil.java:100)
at com.alibaba.nacos.client.config.NacosConfigService.initNamespace(NacosConfigService.java:90)
at com.alibaba.nacos.client.config.NacosConfigService.(NacosConfigService.java:78)
at java.base@17.0.5/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base@17.0.5/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at com.alibaba.nacos.api.config.ConfigFactory.createConfigService(ConfigFactory.java:43)
at com.alibaba.nacos.api.NacosFactory.createConfigService(NacosFactory.java:44)
at com.alibaba.cloud.nacos.NacosConfigManager.createConfigService(NacosConfigManager.java:55)
at com.alibaba.cloud.nacos.NacosConfigManager.(NacosConfigManager.java:43)

There is a high probability that it is because you did not provide a dynamic configuration file. When generating GraalVM Native Image, I suggest that you follow the Spring Boot 3.0 document process for mirroring operations and provide dynamic configuration files for relevant reflections.

github-actions[bot] commented 1 year ago

This issue has been open 30 days with no activity. This will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.