Skip to content

[Bug] Dubbo 3.2.0 cannot load registry configuration from Apollo ConfigCenter #15887

@HGD-coder

Description

@HGD-coder

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 version: 3.2.0
Java version: 11
Config Center: Apollo
Registry: Zookeeper
OS: windows

Steps to reproduce this issue

When using Apollo as ConfigCenter in Dubbo 3.2.0,
Dubbo fails to load registry configuration (dubbo.registry.address) from Apollo.

As a result, the consumer startup fails with the following error:

No such any registry to reference greet.GreetService on the consumer 192.168.194.250
use dubbo version 3.2.0, please config <dubbo:registry address="..." /> to your spring config

At this point, I am not sure whether this behavior is due to a configuration issue on my side, or a potential bug in Dubbo.

java client code

ConfigCenterConfig configCenter = new ConfigCenterConfig();
        configCenter.setProtocol("apollo");
        configCenter.setAddress("http://127.0.0.1:8080");
        configCenter.setNamespace("dubbo-java");
        configCenter.setConfigFile("dubbo-java");
        configCenter.setAppConfigFile("SampleApp");
        configCenter.setGroup("dubbo-java");
        configCenter.setCluster("default");

ReferenceConfig<GreetService> reference = new ReferenceConfig<>();
        reference.setInterface(GreetService.class);
        reference.setCheck(false);

DubboBootstrap bootstrap = DubboBootstrap.getInstance()
                .application(APP_ID)
                .configCenter(configCenter)
                .reference(reference)
                .start();

dubbo-java.properties in Apollo config-center

dubbo.registry.address = zookeeper://127.0.0.1:2181

dubbo.protocols.triple.name = tri
dubbo.protocols.triple.port = 20000

dubbo.provider.services.GreeterProvider.interface = greet.GreetService

I am confident that this is not an issue with the configuration center itself, because dubbo-go is able to load the same configuration from the config center and successfully register services to the registry.

go-server in dubbo-go-samples/config_center/apollo

const (
	apolloMetaAddress = "127.0.0.1:8080"
	apolloAppID       = "SampleApp"
	apolloCluster     = "default"
	apolloNamespace   = "dubbo.yml"
)

ins, err := dubbo.NewInstance(
		dubbo.WithConfigCenter(
			config_center.WithApollo(),
			config_center.WithAddress(apolloMetaAddress),
			config_center.WithNamespace(apolloNamespace),
			config_center.WithDataID(apolloNamespace),
			config_center.WithAppID(apolloAppID),
			config_center.WithCluster(apolloCluster),
			//config_center.WithFileExtProperties(),
		),
	)

dubbo.yml in Apollo config-center

dubbo:
  registries:
    demoZK:
      protocol: zookeeper
      timeout: 3s
      address: '127.0.0.1:2181'
  protocols:
    triple:
      name: tri
      port: 20000
  provider:
    services:
      GreeterProvider:
        interface: com.apache.dubbo.sample.basic.IGreeter

What you expected to happen

java.lang.IllegalStateException: No such any registry to reference greet.GreetService on the consumer 192.168.194.250 use dubbo version 3.2.0, please config <dubbo:registry address="..." /> to your spring config.
at org.apache.dubbo.config.ReferenceConfig.aggregateUrlFromRegistry (ReferenceConfig.java:573)
at org.apache.dubbo.config.ReferenceConfig.createProxy (ReferenceConfig.java:430)
at org.apache.dubbo.config.ReferenceConfig.init (ReferenceConfig.java:295)
at org.apache.dubbo.config.ReferenceConfig.get (ReferenceConfig.java:231)
at org.apache.dubbo.config.utils.SimpleReferenceCache.destroyReference (SimpleReferenceCache.java:265)
at org.apache.dubbo.config.utils.SimpleReferenceCache.destroy (SimpleReferenceCache.java:218)
at org.apache.dubbo.config.utils.SimpleReferenceCache.destroy (SimpleReferenceCache.java:242)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.lambda$referServices$6 (DefaultModuleDeployer.java:414)
at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach (ConcurrentHashMap.java:4770)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.referServices (DefaultModuleDeployer.java:389)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.startSync (DefaultModuleDeployer.java:170)
at org.apache.dubbo.config.deploy.DefaultModuleDeployer.start (DefaultModuleDeployer.java:142)
at org.apache.dubbo.config.deploy.DefaultApplicationDeployer.startModules (DefaultApplicationDeployer.java:698)
at org.apache.dubbo.config.deploy.DefaultApplicationDeployer.doStart (DefaultApplicationDeployer.java:662)
at org.apache.dubbo.config.deploy.DefaultApplicationDeployer.start (DefaultApplicationDeployer.java:635)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start (DubboBootstrap.java:227)
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start (DubboBootstrap.java:216)
at org.example.client.ApolloJavaClient.main (ApolloJavaClient.java:50)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.mojo.exec.AbstractExecJavaBase.executeMainMethod (AbstractExecJavaBase.java:402)
at org.codehaus.mojo.exec.ExecJavaMojo.executeMainMethod (ExecJavaMojo.java:142)
at org.codehaus.mojo.exec.AbstractExecJavaBase.doExecClassLoader (AbstractExecJavaBase.java:377)
at org.codehaus.mojo.exec.AbstractExecJavaBase.lambda$execute$0 (AbstractExecJavaBase.java:287)
at java.lang.Thread.run (Thread.java:829)
[WARNING] thread Thread[Dubbo-global-shared-handler-thread-1,5,org.example.client.ApolloJavaClient] was interrupted but is still alive after waiting at least 14999msecs
[WARNING] thread Thread[Dubbo-global-shared-handler-thread-1,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-global-shared-handler-thread-2,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[metrics-collector-sync-job-thread-1,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[qos-boss-1-1,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[NettyServerBoss-4-1,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-1,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-2,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-3,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-4,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-5,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-6,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-7,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] thread Thread[Dubbo-framework-shared-scheduler-thread-8,5,org.example.client.ApolloJavaClient] will linger despite being asked to die via interruption
[WARNING] NOTE: 13 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.AbstractExecJavaBase$IsolatedThreadGroup[name=org.example.client.ApolloJavaClient,maxpri=10]
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.destroy (ThreadGroup.java:776)
at org.codehaus.mojo.exec.AbstractExecJavaBase.execute (AbstractExecJavaBase.java:345)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
``

Anything else

The Apollo configuration center I am using is deployed following the official quick start guide:
https://www.apolloconfig.com/#/zh/deployment/quick-start

I have tried both Docker-based deployment and local deployment, but neither approach works.

The Zookeeper registry I am using is provided by the docker-compose configuration in:
dubbo-go-samples/integrate_test/dockercompose/docker-compose.yml

I have also carefully reviewed the following documents:

https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/reference-manual/config-center/apollo/

#3266

However, I am still confused about the correct behavior and configuration

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions