<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>Dubbo version: 2.7.0+</li>
<li>Operating System version: mac</li>
<li>Java version: 1.8</li>
</ul>
<h2 dir="auto">Steps to reproduce this issue</h2>
<p dir="auto">Assume that there is an interface below：</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package org.apache.dubbo.demo;
public interface DemoService {
    String sayHello(String name);
}

package org.apache.dubbo.demo.provider;
import org.apache.dubbo.demo.DemoService;
public class DemoAService implements DemoService {
    @Override
    public String sayHello(String name) {
        return &quot;Hello &quot; + name + &quot;, response from provider: &quot; + this.getClass().getSimpleName();
    }
}

package org.apache.dubbo.demo.provider;
import org.apache.dubbo.demo.DemoService;
public class DemoBService implements DemoService {
    @Override
    public String sayHello(String name) {
        return &quot;Hello &quot; + name + &quot;, response from provider: &quot; + this.getClass().getSimpleName();
    }
}"><pre class="notranslate"><span class="pl-k">package</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">demo</span>;
<span class="pl-k">public</span> <span class="pl-k">interface</span> <span class="pl-smi">DemoService</span> {
    <span class="pl-smi">String</span> <span class="pl-en">sayHello</span>(<span class="pl-smi">String</span> <span class="pl-s1">name</span>);
}

<span class="pl-k">package</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">demo</span>.<span class="pl-s1">provider</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">demo</span>.<span class="pl-s1">DemoService</span>;
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DemoAService</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">sayHello</span>(<span class="pl-smi">String</span> <span class="pl-s1">name</span>) {
        <span class="pl-k">return</span> <span class="pl-s">"Hello "</span> + <span class="pl-s1">name</span> + <span class="pl-s">", response from provider: "</span> + <span class="pl-smi">this</span>.<span class="pl-en">getClass</span>().<span class="pl-en">getSimpleName</span>();
    }
}

<span class="pl-k">package</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">demo</span>.<span class="pl-s1">provider</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">demo</span>.<span class="pl-s1">DemoService</span>;
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">DemoBService</span> <span class="pl-k">implements</span> <span class="pl-smi">DemoService</span> {
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">sayHello</span>(<span class="pl-smi">String</span> <span class="pl-s1">name</span>) {
        <span class="pl-k">return</span> <span class="pl-s">"Hello "</span> + <span class="pl-s1">name</span> + <span class="pl-s">", response from provider: "</span> + <span class="pl-smi">this</span>.<span class="pl-en">getClass</span>().<span class="pl-en">getSimpleName</span>();
    }
}</pre></div>
<p dir="auto">dubbo-demo-provider.xml:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    &lt;!-- service implementation, as same as regular local bean --&gt;
    &lt;bean id=&quot;demoAService&quot; class=&quot;org.apache.dubbo.demo.provider.DemoAService&quot;/&gt;

    &lt;!-- declare the service interface to be exported --&gt;
    &lt;dubbo:service interface=&quot;org.apache.dubbo.demo.DemoService&quot; ref=&quot;demoAService&quot; group=&quot;demoA&quot;/&gt;

    &lt;!-- service implementation, as same as regular local bean --&gt;
    &lt;bean id=&quot;demoBService&quot; class=&quot;org.apache.dubbo.demo.provider.DemoBService&quot;/&gt;

    &lt;!-- declare the service interface to be exported --&gt;
    &lt;dubbo:service interface=&quot;org.apache.dubbo.demo.DemoService&quot; ref=&quot;demoBService&quot; group=&quot;demoB&quot;/&gt;"><pre class="notranslate"><code class="notranslate">    &lt;!-- service implementation, as same as regular local bean --&gt;
    &lt;bean id="demoAService" class="org.apache.dubbo.demo.provider.DemoAService"/&gt;

    &lt;!-- declare the service interface to be exported --&gt;
    &lt;dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoAService" group="demoA"/&gt;

    &lt;!-- service implementation, as same as regular local bean --&gt;
    &lt;bean id="demoBService" class="org.apache.dubbo.demo.provider.DemoBService"/&gt;

    &lt;!-- declare the service interface to be exported --&gt;
    &lt;dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoBService" group="demoB"/&gt;
</code></pre></div>
<h2 dir="auto">Start telnet call service：</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="incubator-dubbo yeling$ telnet localhost 20880
dubbo&gt;ls
org.apache.dubbo.demo.DemoService
org.apache.dubbo.demo.DemoService
dubbo&gt;invoke org.apache.dubbo.demo.DemoService.sayHello(&quot;china&quot;) 
&quot;Hello china, response from provider: DemoAService&quot;"><pre class="notranslate">incubator-dubbo yeling$ telnet localhost 20880
dubbo<span class="pl-k">&gt;</span>ls
org.apache.dubbo.demo.DemoService
org.apache.dubbo.demo.DemoService
dubbo<span class="pl-k">&gt;</span>invoke org.apache.dubbo.demo.DemoService.sayHello(<span class="pl-s"><span class="pl-pds">"</span>china<span class="pl-pds">"</span></span>) 
<span class="pl-s"><span class="pl-pds">"</span>Hello china, response from provider: DemoAService<span class="pl-pds">"</span></span></pre></div>
<ul dir="auto">
<li>Always only call the provider DemoAService，There's no way I can invoke to DemoBService.</li>
</ul>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.7 and 2.6.5</li>
<li>Operating System version: common linux vm</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>java process use dubbo 2.7.7 with org.apache package</li>
<li>copy dubbo 2.6.5 to process lib dir</li>
</ol>
<p dir="auto">so we have two ExtensionFactory</p>
<p dir="auto">2.7.7</p>
<p dir="auto">spring=org.apache.dubbo.config.spring.extension.SpringExtensionFactory<br>
adaptive=org.apache.dubbo.common.extension.factory.AdaptiveExtensionFactory<br>
spi=org.apache.dubbo.common.extension.factory.SpiExtensionFactory</p>
<p dir="auto">2.6.5<br>
spring=com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory<br>
adaptive=com.alibaba.dubbo.common.extension.factory.AdaptiveExtensionFactory<br>
spi=com.alibaba.dubbo.common.extension.factory.SpiExtensionFactory</p>
<p dir="auto">when class run: org.apache.dubbo.common.extension.ExtensionLoader</p>
<p dir="auto">line:755~758</p>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    for (LoadingStrategy strategy : strategies) {
        loadDirectory(extensionClasses, strategy.directory(), type.getName(), strategy.preferExtensionClassLoader(), strategy.overridden(), strategy.excludedPackages());
        loadDirectory(extensionClasses, strategy.directory(), type.getName().replace(&quot;org.apache&quot;, &quot;com.alibaba&quot;), strategy.preferExtensionClassLoader(), strategy.overridden(), strategy.excludedPackages());
    }"><pre class="notranslate"><code class="notranslate">    for (LoadingStrategy strategy : strategies) {
        loadDirectory(extensionClasses, strategy.directory(), type.getName(), strategy.preferExtensionClassLoader(), strategy.overridden(), strategy.excludedPackages());
        loadDirectory(extensionClasses, strategy.directory(), type.getName().replace("org.apache", "com.alibaba"), strategy.preferExtensionClassLoader(), strategy.overridden(), strategy.excludedPackages());
    }
</code></pre></div>
</blockquote>
<p dir="auto"><strong>when the secend loadDirectory run and it will find 2.6.5 META properties and load adaptive=com.alibaba.dubbo.common.extension.factory.AdaptiveExtensionFactory</strong></p>
<p dir="auto">and the line 877 can not go into ,for the class name of Adaptive are different ,maybe this judgment statement should change like ：<br>
if (clazz.isAnnotationPresent(Adaptive.class)  || clazz.isAnnotationPresent(com.alibaba.dubbo.common.extension.Adaptive.class)) {</p>
<p dir="auto">line:870~899</p>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private void loadClass(Map&lt;String, Class&lt;?&gt;&gt; extensionClasses, java.net.URL resourceURL, Class&lt;?&gt; clazz, String name,
                       boolean overridden) throws NoSuchMethodException {
    if (!type.isAssignableFrom(clazz)) {
        throw new IllegalStateException(&quot;Error occurred when loading extension class (interface: &quot; +
                type + &quot;, class line: &quot; + clazz.getName() + &quot;), class &quot;
                + clazz.getName() + &quot; is not subtype of interface.&quot;);
    }
    if (clazz.isAnnotationPresent(Adaptive.class)) {
        cacheAdaptiveClass(clazz, overridden);
    } else if (isWrapperClass(clazz)) {
        cacheWrapperClass(clazz);
    } else {
        clazz.getConstructor();
        if (StringUtils.isEmpty(name)) {
            name = findAnnotationName(clazz);
            if (name.length() == 0) {
                throw new IllegalStateException(&quot;No such extension name for the class &quot; + clazz.getName() + &quot; in the config &quot; + resourceURL);
            }
        }

        String[] names = NAME_SEPARATOR.split(name);
        if (ArrayUtils.isNotEmpty(names)) {
            cacheActivateClass(clazz, names[0]);
            for (String n : names) {
                cacheName(clazz, n);
                saveInExtensionClass(extensionClasses, clazz, n, overridden);
            }
        }
    }
}"><pre class="notranslate"><code class="notranslate">private void loadClass(Map&lt;String, Class&lt;?&gt;&gt; extensionClasses, java.net.URL resourceURL, Class&lt;?&gt; clazz, String name,
                       boolean overridden) throws NoSuchMethodException {
    if (!type.isAssignableFrom(clazz)) {
        throw new IllegalStateException("Error occurred when loading extension class (interface: " +
                type + ", class line: " + clazz.getName() + "), class "
                + clazz.getName() + " is not subtype of interface.");
    }
    if (clazz.isAnnotationPresent(Adaptive.class)) {
        cacheAdaptiveClass(clazz, overridden);
    } else if (isWrapperClass(clazz)) {
        cacheWrapperClass(clazz);
    } else {
        clazz.getConstructor();
        if (StringUtils.isEmpty(name)) {
            name = findAnnotationName(clazz);
            if (name.length() == 0) {
                throw new IllegalStateException("No such extension name for the class " + clazz.getName() + " in the config " + resourceURL);
            }
        }

        String[] names = NAME_SEPARATOR.split(name);
        if (ArrayUtils.isNotEmpty(names)) {
            cacheActivateClass(clazz, names[0]);
            for (String n : names) {
                cacheName(clazz, n);
                saveInExtensionClass(extensionClasses, clazz, n, overridden);
            }
        }
    }
}
</code></pre></div>
</blockquote>
<blockquote>
</blockquote>