@carryxyh you can try it . if you not provider URL key to extension name . How
it work , if have not default SPI value.
I saw the RouterFactory code follow, it provider default value "null" :
```
public org.apache.dubbo.rpc.cluster.Router
getRouter(org.apache.dubbo.common.URL arg0)
{
if (arg0 == null)
throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
String extName = url.getProtocol();
if (extName == null)
throw new IllegalStateException(
"Fail to get
extension(org.apache.dubbo.rpc.cluster.RouterFactory) name from url(" +
url.toString()
+ ") use keys([protocol])");
org.apache.dubbo.rpc.cluster.RouterFactory extension = null;
try
{
extension = (org.apache.dubbo.rpc.cluster.RouterFactory)
ExtensionLoader
.getExtensionLoader(org.apache.dubbo.rpc.cluster.RouterFactory.class).getExtension(extName);
}
catch (Exception e)
{
if (count.incrementAndGet() == 1)
{
logger.warn("Failed to find extension named " + extName
+ " for type
org.apache.dubbo.rpc.cluster.RouterFactory, will use default extension null
instead.",
e);
}
extension = (org.apache.dubbo.rpc.cluster.RouterFactory)
ExtensionLoader
.getExtensionLoader(org.apache.dubbo.rpc.cluster.RouterFactory.class).getExtension("null");
}
return extension.getRouter(arg0);
}
```
[ Full content available at:
https://github.com/apache/incubator-dubbo/issues/2398 ]
This message was relayed via gitbox.apache.org for [email protected]