<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/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.8</li>
<li>Operating System version: WINDOWS 10 20H1</li>
<li>Java version: Java 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>配置文件中指定apollo配置中心的相关值。</li>
</ol>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="dubbo:
  config-center:
    address: apollo://t.ppssxx.com:8080
    # 配置中心的配置覆盖本地配置
    highest-priority: true
    namespace: TEST1.dubbo
    config-file: TEST1.dubbo.properties
    group: TEST1.dubbo
    app-config-file: TEST1.dubbo.properties"><pre class="notranslate"><span class="pl-ent">dubbo</span>:
  <span class="pl-ent">config-center</span>:
    <span class="pl-ent">address</span>: <span class="pl-s">apollo://t.ppssxx.com:8080</span>
    <span class="pl-c"><span class="pl-c">#</span> 配置中心的配置覆盖本地配置</span>
    <span class="pl-ent">highest-priority</span>: <span class="pl-c1">true</span>
    <span class="pl-ent">namespace</span>: <span class="pl-s">TEST1.dubbo</span>
    <span class="pl-ent">config-file</span>: <span class="pl-s">TEST1.dubbo.properties</span>
    <span class="pl-ent">group</span>: <span class="pl-s">TEST1.dubbo</span>
    <span class="pl-ent">app-config-file</span>: <span class="pl-s">TEST1.dubbo.properties</span></pre></div>
<ol start="2" dir="auto">
<li>启动应用，拉取配置</li>
<li>应用启动失败</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？</p>
<p dir="auto">应该正确获取到配置文件中指定的Namespace值,在本场景中为<code class="notranslate">TEST1.dubbo</code></p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">未能正确获取，而是变成了默认的<code class="notranslate">dubbo</code><br>
What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2020-08-16 23:34:37.645 ERROR 3752 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to connect to config center, the config center is Apollo, the address is: http://xxx:8080
	at org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfiguration.&lt;init&gt;(ApolloDynamicConfiguration.java:109) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfigurationFactory.createDynamicConfiguration(ApolloDynamicConfigurationFactory.java:29) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.common.config.configcenter.AbstractDynamicConfigurationFactory.lambda$getDynamicConfiguration$0(AbstractDynamicConfigurationFactory.java:39) ~[dubbo-2.7.8.jar:2.7.8]
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[na:na]
	at org.apache.dubbo.common.config.configcenter.AbstractDynamicConfigurationFactory.getDynamicConfiguration(AbstractDynamicConfigurationFactory.java:39) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.common.config.configcenter.DynamicConfiguration.getDynamicConfiguration(DynamicConfiguration.java:224) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.prepareEnvironment(DubboBootstrap.java:1034) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.startConfigCenter(DubboBootstrap.java:623) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.initialize(DubboBootstrap.java:521) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:896) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:59) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:52) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.OneTimeExecutionApplicationContextEventListener.onApplicationEvent(OneTimeExecutionApplicationContextEventListener.java:40) ~[dubbo-2.7.8.jar:2.7.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at com.sf.dubbo.bootstrap.providerApplication.main(providerApplication.java:28) ~[classes/:na]"><pre class="notranslate"><code class="notranslate">2020-08-16 23:34:37.645 ERROR 3752 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to connect to config center, the config center is Apollo, the address is: http://xxx:8080
	at org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfiguration.&lt;init&gt;(ApolloDynamicConfiguration.java:109) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfigurationFactory.createDynamicConfiguration(ApolloDynamicConfigurationFactory.java:29) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.common.config.configcenter.AbstractDynamicConfigurationFactory.lambda$getDynamicConfiguration$0(AbstractDynamicConfigurationFactory.java:39) ~[dubbo-2.7.8.jar:2.7.8]
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[na:na]
	at org.apache.dubbo.common.config.configcenter.AbstractDynamicConfigurationFactory.getDynamicConfiguration(AbstractDynamicConfigurationFactory.java:39) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.common.config.configcenter.DynamicConfiguration.getDynamicConfiguration(DynamicConfiguration.java:224) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.prepareEnvironment(DubboBootstrap.java:1034) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.startConfigCenter(DubboBootstrap.java:623) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.initialize(DubboBootstrap.java:521) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:896) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:59) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:52) ~[dubbo-2.7.8.jar:2.7.8]
	at org.apache.dubbo.config.spring.context.OneTimeExecutionApplicationContextEventListener.onApplicationEvent(OneTimeExecutionApplicationContextEventListener.java:40) ~[dubbo-2.7.8.jar:2.7.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
	at com.sf.dubbo.bootstrap.providerApplication.main(providerApplication.java:28) ~[classes/:na]
</code></pre></div>
<p dir="auto">查看源码和调式发现：<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/apache/dubbo/blob/0be2a1bbbf9168490acecaf1eed1bd16cb8db402/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java#L99-L102">dubbo/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 99 to 102
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/dubbo/commit/0be2a1bbbf9168490acecaf1eed1bd16cb8db402">0be2a1b</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L99" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="99"></td>
          <td id="LC99" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-smi">String</span> <span class="pl-s1">namespace</span> = <span class="pl-s1">url</span>.<span class="pl-en">getParameter</span>(<span class="pl-c1">CONFIG_NAMESPACE_KEY</span>, <span class="pl-c1">DEFAULT_GROUP</span>); </td>
        </tr>

        <tr class="border-0">
          <td id="L100" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="100"></td>
          <td id="LC100" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-smi">String</span> <span class="pl-s1">apolloNamespace</span> = <span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">namespace</span>) ? <span class="pl-s1">url</span>.<span class="pl-en">getParameter</span>(<span class="pl-c1">GROUP_KEY</span>, <span class="pl-c1">DEFAULT_GROUP</span>) : <span class="pl-s1">namespace</span>; </td>
        </tr>

        <tr class="border-0">
          <td id="L101" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="101"></td>
          <td id="LC101" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">dubboConfig</span> = <span class="pl-smi">ConfigService</span>.<span class="pl-en">getConfig</span>(<span class="pl-s1">apolloNamespace</span>); </td>
        </tr>

        <tr class="border-0">
          <td id="L102" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="102"></td>
          <td id="LC102" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">dubboConfigFile</span> = <span class="pl-smi">ConfigService</span>.<span class="pl-en">getConfigFile</span>(<span class="pl-s1">apolloNamespace</span>, <span class="pl-smi">ConfigFileFormat</span>.<span class="pl-s1">Properties</span>); </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
这里截取的ParameterKey 不对，这里获取的是<code class="notranslate">config.namespace</code>，而在url内部的Parameter实际为<code class="notranslate">namesapce</code>，导致获取为空，由于给了默认值下面的语句判空也没有发挥任何作用，appConfigFile的值也未能正确获取到。<p></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/13273667/90338605-70d67e00-e01d-11ea-962e-0e8bea8c2479.png"><img src="https://user-images.githubusercontent.com/13273667/90338605-70d67e00-e01d-11ea-962e-0e8bea8c2479.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/13273667/90338612-79c74f80-e01d-11ea-9117-aeff8ee271d1.png"><img src="https://user-images.githubusercontent.com/13273667/90338612-79c74f80-e01d-11ea-9117-aeff8ee271d1.png" alt="image" style="max-width: 100%;"></a></p>
<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.2-SNAPSHOT</li>
<li>Operating System version: xxx</li>
<li>Java version: xxx</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" private String[] getCategories(URL url) {
        return ANY_VALUE.equals(url.getServiceInterface()) ?
                ALL_SUPPORTED_CATEGORIES : of(DEFAULT_CATEGORY);
    }"><pre class="notranslate"> <span class="pl-k">private</span> <span class="pl-smi">String</span>[] <span class="pl-s1">getCategories</span>(<span class="pl-smi">URL</span> <span class="pl-s1">url</span>) {
        <span class="pl-k">return</span> <span class="pl-smi">ANY_VALUE</span>.<span class="pl-en">equals</span>(<span class="pl-s1">url</span>.<span class="pl-en">getServiceInterface</span>()) ?
                <span class="pl-c1">ALL_SUPPORTED_CATEGORIES</span> : <span class="pl-en">of</span>(<span class="pl-c1">DEFAULT_CATEGORY</span>);
    }</pre></div>
<p dir="auto">i think it shoudl be :</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private String[] getCategories(URL url) {
        return ANY_VALUE.equals(url.getServiceInterface()) ?
                ALL_SUPPORTED_CATEGORIES : of(url.getParameter(CATEGORY_KEY,DEFAULT_CATEGORY));
    }"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-smi">String</span>[] <span class="pl-s1">getCategories</span>(<span class="pl-smi">URL</span> <span class="pl-s1">url</span>) {
        <span class="pl-k">return</span> <span class="pl-smi">ANY_VALUE</span>.<span class="pl-en">equals</span>(<span class="pl-s1">url</span>.<span class="pl-en">getServiceInterface</span>()) ?
                <span class="pl-c1">ALL_SUPPORTED_CATEGORIES</span> : <span class="pl-en">of</span>(<span class="pl-s1">url</span>.<span class="pl-en">getParameter</span>(<span class="pl-c1">CATEGORY_KEY</span>,<span class="pl-c1">DEFAULT_CATEGORY</span>));
    }</pre></div>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>