We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在启动类中 1、注入
@NacosInjected private ConfigService configService;
2、在注解@PostConstruct修饰的方法内部通过
CompletableFuture.runAsync(() -> { configService.getConfig("dataId", "group", 5000L); });
idea启动正常,但通过打包后,jar -jar方式启动则 上面异步线程中 无法获取到配置 报异常com.alibaba.nacos.common.remote.exception.RemoteException: errCode: 500, errMsg: Unknown payload type:ServerCheckResponse
com.alibaba.nacos.common.remote.exception.RemoteException: errCode: 500, errMsg: Unknown payload type:ServerCheckResponse
理论上应该获取到配置,目前看是spi加载实现类失效,因为在jar -jar方式启动时 ForkJoinPool使用的是jdk.internal.loader.ClassLoaders$AppClassLoader 而main方法是org.springframework.boot.loader.LaunchedURLClassLoader
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -Xms1G -Xmx1G -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M -XX:+UseG1GC -XX:+AlwaysPreTouch -XX:-ResizePLAB -XX:+ParallelRefProcEnabled -XX:+ExplicitGCInvokesConcurrent -XX:MaxGCPauseMillis=50 -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=10 -XX:InitiatingHeapOccupancyPercent=45 -Xbootclasspath/a:D:\work\project\service\src\main\resources\config\pre -jar D:\work\project\service\target\service.jar com.xxx.yyyy.ApplicationStart
环境为:spring-boot项目当中 2.7.18版本 jdk17
目前使用的客户端依赖
<dependency> <groupId>com.alibaba.boot</groupId> <artifactId>nacos-config-spring-boot-starter</artifactId> <version>0.3.0-RC</version> <exclusions> <exclusion> <artifactId>nacos-client</artifactId> <groupId>com.alibaba.nacos</groupId> </exclusion> <exclusion> <artifactId>nacos-spring-context</artifactId> <groupId>com.alibaba.nacos</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.alibaba.nacos</groupId> <artifactId>nacos-client</artifactId> <version>2.4.2</version> <exclusions> <exclusion> <artifactId>simpleclient</artifactId> <groupId>io.prometheus</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.alibaba.nacos</groupId> <artifactId>nacos-common</artifactId> <version>2.4.2</version> <exclusions> <exclusion> <artifactId>nacos-api</artifactId> <groupId>com.alibaba.nacos</groupId> </exclusion> <exclusion> <artifactId>commons-io</artifactId> <groupId>commons-io</groupId> </exclusion> </exclusions> </dependency> <dependency> <artifactId>nacos-spring-context</artifactId> <groupId>com.alibaba.nacos</groupId> <version>2.1.1-RC</version> <exclusions> <exclusion> <artifactId>nacos-client</artifactId> <groupId>com.alibaba.nacos</groupId> </exclusion> </exclusions> </dependency>
目前暂时这么解决的:
ClassLoader loader = Thread.currentThread().getContextClassLoader(); CompletableFuture.runAsync(() -> { Thread.currentThread().setContextClassLoader(loader); configService.getConfig("dataId", "group", 5000L); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue Description
在启动类中
1、注入
2、在注解@PostConstruct修饰的方法内部通过
Describe what happened (or what feature you want)
idea启动正常,但通过打包后,jar -jar方式启动则 上面异步线程中 无法获取到配置 报异常
com.alibaba.nacos.common.remote.exception.RemoteException: errCode: 500, errMsg: Unknown payload type:ServerCheckResponse
Describe what you expected to happen
理论上应该获取到配置,目前看是spi加载实现类失效,因为在jar -jar方式启动时 ForkJoinPool使用的是jdk.internal.loader.ClassLoaders$AppClassLoader 而main方法是org.springframework.boot.loader.LaunchedURLClassLoader
How to reproduce it (as minimally and precisely as possible)
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -Xms1G -Xmx1G -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M -XX:+UseG1GC -XX:+AlwaysPreTouch -XX:-ResizePLAB -XX:+ParallelRefProcEnabled -XX:+ExplicitGCInvokesConcurrent -XX:MaxGCPauseMillis=50 -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=10 -XX:InitiatingHeapOccupancyPercent=45 -Xbootclasspath/a:D:\work\project\service\src\main\resources\config\pre -jar D:\work\project\service\target\service.jar com.xxx.yyyy.ApplicationStart
Tell us your environment
环境为:spring-boot项目当中 2.7.18版本 jdk17
Anything else we need to know?
目前使用的客户端依赖
目前暂时这么解决的:
The text was updated successfully, but these errors were encountered: