xiaoligit opened a new issue, #15304:
URL: https://github.com/apache/dubbo/issues/15304

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   dubbo 3.2.16, window jdk17.
   
   
   
   ### Steps to reproduce this issue
   
   ****1、config two protocol in a app****
   
dubbo.protocols.protocol-hs-cms-server-dubbo1.id=protocol-hs-cms-server-dubbo1
   dubbo.protocols.protocol-hs-cms-server-dubbo1.name=dubbo
   dubbo.protocols.protocol-hs-cms-server-dubbo1.dispatcher=message
   dubbo.protocols.protocol-hs-cms-server-dubbo1.threadpool=limited
   dubbo.protocols.protocol-hs-cms-server-dubbo1.threads=400
   
   
dubbo.protocols.protocol-hs-cms-server-dubbo2.id=protocol-hs-cms-server-dubbo2
   dubbo.protocols.protocol-hs-cms-server-dubbo2.name=dubbo
   dubbo.protocols.protocol-hs-cms-server-dubbo2.dispatcher=message
   dubbo.protocols.protocol-hs-cms-server-dubbo2.threadpool=limited
   dubbo.protocols.protocol-hs-cms-server-dubbo2.threads=200
   
   
   
   ### What you expected to happen
   
   2025-04-09 22:39:46.020 ERROR 145968 --- [           main] 
o.a.d.c.b.b.InternalServiceConfigBuilder :  [DUBBO] Failed to find any valid 
protocol, will use random port to export  service., dubbo version: 3.2.16, 
current host: 10.244.6.10, error code: 99-0. This may be caused by invalid 
specified null  port, error Found more than one config by name: dubbo, 
instances: [<dubbo:protocol preferSerialization="fastjson2,hessian2" 
dispatcher="message" threads="400" name="dubbo" threadpool="limited" 
id="protocol-hs-cms-server-dubbo1" />, <dubbo:protocol 
preferSerialization="fastjson2,hessian2" dispatcher="message" threads="200" 
name="dubbo" threadpool="limited" id="protocol-hs-cms-server-dubbo2" />]. 
Please remove redundant configs or get config by id., go to 
https://dubbo.apache.org/faq/99/0 to find instructions. 
   
   java.lang.IllegalStateException: Found more than one config by name: dubbo, 
instances: [<dubbo:protocol preferSerialization="fastjson2,hessian2" 
dispatcher="message" threads="400" name="dubbo" threadpool="limited" 
id="protocol-hs-cms-server-dubbo1" />, <dubbo:protocol 
preferSerialization="fastjson2,hessian2" dispatcher="message" threads="200" 
name="dubbo" threadpool="limited" id="protocol-hs-cms-server-dubbo2" />]. 
Please remove redundant configs or get config by id.
        at 
org.apache.dubbo.config.context.AbstractConfigManager.getConfigByName(AbstractConfigManager.java:350)
 ~[dubbo-3.2.16.jar:3.2.16]
        at 
org.apache.dubbo.config.context.AbstractConfigManager.getConfig(AbstractConfigManager.java:327)
 ~[dubbo-3.2.16.jar:3.2.16]
        at 
org.apache.dubbo.config.context.ConfigManager.getProtocol(ConfigManager.java:197)
 ~[dubbo-3.2.16.jar:3.2.16]
        at 
org.apache.dubbo.config.bootstrap.builders.InternalServiceConfigBuilder.getProtocolConfig(InternalServiceConfigBuilder.java:255)
 ~[dubbo-3.2.16.jar:3.2.16]
   
   ### Anything else
   
   **The possible reason for this issue is that the newly added 
InvokerCountWrapper class does not implement the getService() method.**
   
   public class InvokerCountWrapper implements Protocol {
       private final Protocol protocol;
   
       public InvokerCountWrapper(Protocol protocol) {
           this.protocol = protocol;
       }
   
       public int getDefaultPort() {
           return this.protocol.getDefaultPort();
       }
   
       public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
           return this.protocol.export(invoker);
       }
   
       public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
           return (Invoker)(UrlUtils.isRegistry(url) ? 
this.protocol.refer(type, url) : new 
ReferenceCountInvokerWrapper(this.protocol.refer(type, url)));
       }
   
       public void destroy() {
           this.protocol.destroy();
       }
   }
   
   ### 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
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to