[Bug]:Can not aquire the specific config
Describe the bug
environments:
- java version: corretto 21
- nacos sdk/client version: 2.3.2
- nacos deployment mode: standalone, windows10 PC
I start a dubbo service on local PC(the code of this dubbo service comes from the dubbo-samples), using nacos client 2.2.0. And it works fine, the service registered and I can find the config and service info through the console:
Following the "quick start" of the official website , I want to get the config content of "dataId=org.apache.dubbo.samples.UserService:::provider:shop-user, group=dubbo" as below:
public class NacosApplication {
public static void main(String[] args) {
String content;
try {
String serverAddr = "localhost:8848";
String dataId = "org.apache.dubbo.samples.UserService:::provider:shop-user";
String group = "dubbo";
Properties properties = new Properties();
properties.put("serverAddr", serverAddr);
ConfigService configService = NacosFactory.createConfigService(properties);
content = configService.getConfig(dataId, group, 5000);
System.out.println("content is:"+content);
} catch (NacosException e) {
e.printStackTrace();
}
}
}
The expected result config content should be :
But it returns null:
Then I change the dataId and group to try to aquire another config content:
public class NacosApplication {
public static void main(String[] args) {
String content;
try {
String serverAddr = "localhost:8848";
String dataId = "org.apache.dubbo.samples.UserService";
String group = "mapping";
Properties properties = new Properties();
properties.put("serverAddr", serverAddr);
ConfigService configService = NacosFactory.createConfigService(properties);
content = configService.getConfig(dataId, group, 5000);
System.out.println("content is:"+content);
} catch (NacosException e) {
e.printStackTrace();
}
}
}
It works fine just as below, which is really wired:
I have confirmed that the dataId and group is the same as the console shows, I have no idea for this bug, can someone tell me where the problem lies?
你好,麻烦将不可用的配置内容,dataId和group发一下,我复现下看看
你好,麻烦将不可用的配置内容,dataId和group发一下,我复现下看看
dataId: org.apache.dubbo.samples.UserService:::provider:shop-user group: dubbo content: {"annotations":[],"canonicalName":"org.apache.dubbo.samples.UserService","codeSource":"file:/D:/code/dubbo-samples/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/target/classes/","methods":[{"annotations":[],"name":"register","parameterTypes":["org.apache.dubbo.samples.User"],"parameters":[],"returnType":"boolean"},{"annotations":[],"name":"getInfo","parameterTypes":["java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"},{"annotations":[],"name":"login","parameterTypes":["java.lang.String","java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"},{"annotations":[],"name":"timeoutLogin","parameterTypes":["java.lang.String","java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"}],"parameters":{"anyhost":"true","pid":"20560","interface":"org.apache.dubbo.samples.UserService","side":"provider","dubbo":"2.0.2","application":"shop-user","release":"3.2.7","executor-management-mode":"isolation","file-cache":"true","methods":"getInfo,login,register,timeoutLogin","deprecated":"false","qos.port":"20994","service-name-mapping":"true","timeout":"1000","generic":"false","bind.port":"20884","token":"d9f0fc3f-2fc6-4684-9405-e8c2311df916","qos.anonymous.access.permission.level":"PROTECTED","bind.ip":"2.0.0.1","prefer.serialization":"fastjson2,hessian2","background":"false","dynamic":"true","qos.anonymous.access.allow.commands":"metrics","timestamp":"1713234842852"},"types":[{"enums":[],"items":[],"properties":{},"type":"boolean"},{"enums":[],"items":[],"properties":{"realName":"java.lang.String","password":"java.lang.String","mail":"java.lang.String","phone":"java.lang.String","env":"java.lang.String","username":"java.lang.String"},"type":"org.apache.dubbo.samples.User"},{"enums":[],"items":[],"properties":{},"type":"java.lang.String"}],"uniqueId":"org.apache.dubbo.samples.UserService@file:/D:/code/dubbo-samples/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/target/classes/"}
我用jdk8和jdk21都没有复现出来,客户端debug看下请求 服务端看下config-pull-check.log,或者配置nacos.plugin.datasource.log.enabled=true看下sql对不对
debug:
config-dump.log
config-pull-check.log
看起来是server端有些问题
看样子是client获取到数据后保存快照的时候报错了,文件名特殊符号不支持
新版本应该在写缓存的时候有进行encode的,是否是系统版本读取的时候没读取正确?
可以看下 PathEncode 和PathEncodeManager是否没有用上或者读取错误导致没有识别到用Windows的PathEncode
#10101
com.alibaba.nacos.config.server.service.dump.disk.ConfigRawDiskService
DiskUtil被迁移到了这个上面,但是丢失了#10101中的encode修复
这个问题在哪些版本中存在?