-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
环境:Dubbo SDK 3.2.13, jdk21
当使用nacos作为注册中心,设置用户名密码包含“#”字符时候,导致URLStrParser.parseURLBody()忽略“#”后面的字符,从而导致解析失败。
具体错误信息如下:
java.lang.RuntimeException: Can not create registry service-discovery-registry://111.230.37.113:18848/org.apache.dubbo.registry.RegistryService?REGISTRY_CLUSTER=default&application=service-cbill&dubbo=2.0.2&executor-management-mode=isolation&file=./service-cbill/dubbo/1&file-cache=true&group=test&interface=org.apache.dubbo.registry.RegistryService&logger=slf4j&password=nacos#2_024&pid=20182®ister=false®istry=nacos®istry-type=service®istry.type=service&release=3.2.13&username=nacos
at org.apache.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:105)
at org.apache.dubbo.registry.RegistryFactoryWrapper.getRegistry(RegistryFactoryWrapper.java:33)
at org.apache.dubbo.registry.RegistryFactory$Adaptive.getRegistry(RegistryFactory$Adaptive.java)
at org.apache.dubbo.registry.integration.RegistryProtocol.getRegistry(RegistryProtocol.java:459)
at org.apache.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:266)
at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:79)
at org.apache.dubbo.rpc.protocol.ProtocolSecurityWrapper.export(ProtocolSecurityWrapper.java:84)
at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:66)
at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:58)
at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.export(ProtocolSerializationWrapper.java:50)
at org.apache.dubbo.rpc.protocol.InvokerCountWrapper.export(InvokerCountWrapper.java:42)
at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java)
at org.apache.dubbo.config.ServiceConfig.doExportUrl(ServiceConfig.java:947)
at org.apache.dubbo.config.ServiceConfig.exportRemote(ServiceConfig.java:917)
at org.apache.dubbo.config.ServiceConfig.exportUrl(ServiceConfig.java:857)
at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:602)
at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:583)
at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:540)
at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:340)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServiceInternal(DefaultModuleDeployer.java:477)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServices(DefaultModuleDeployer.java:424)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.startSync(DefaultModuleDeployer.java:174)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.start(DefaultModuleDeployer.java:156)
at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextRefreshedEvent(DubboDeployApplicationListener.java:157)
at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:143)
at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:52)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:984)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
at org.cbill.base.ServiceCBillApplication.main(ServiceCBillApplication.java:16)
Caused by: java.lang.NumberFormatException: For input string: "nacos"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:661)
at java.base/java.lang.Integer.parseInt(Integer.java:777)
at org.apache.dubbo.common.URLStrParser.parseURLBody(URLStrParser.java:161)
at org.apache.dubbo.common.URLStrParser.parseDecodedStr(URLStrParser.java:59)
at org.apache.dubbo.common.URL.valueOf(URL.java:258)
at org.apache.dubbo.common.URL.valueOf(URL.java:238)
at org.apache.dubbo.registry.nacos.NacosServiceDiscoveryFactory.createRegistryCacheKey(NacosServiceDiscoveryFactory.java:31)
at org.apache.dubbo.registry.client.AbstractServiceDiscoveryFactory.getServiceDiscovery(AbstractServiceDiscoveryFactory.java:53)
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.getServiceDiscovery(ServiceDiscoveryRegistry.java:133)
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.createServiceDiscovery(ServiceDiscoveryRegistry.java:119)
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.(ServiceDiscoveryRegistry.java:94)
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryFactory.createRegistry(ServiceDiscoveryRegistryFactory.java:40)
at org.apache.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRe
Steps to reproduce this issue
- 启动nacos2.3.2注册中心,修改用户密码,让它包含#字符。
- 使用spring boot 配置dubbo。
- 启动dubbo提供者,程序出现错误。
What you expected to happen
因为密码增加特殊字符可以让它更加难被破解。我觉得让nacos设置密码包含“#”是可被接受的。希望dubbo SDK能够优化解析URL的逻辑,允许密码出现特殊字符。
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
