apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
29.17k stars 10.2k forks source link

@nobodyiam dubbo相关配置配在application.properties里时是可以正常运行的 现在dubbo的相关配置都迁移到apollo配置中心了 就报上面的错误了 该试的情况我都尝试过了 都没发现原因 难道是因为项目里dubbo是以xml形式配置的 apollo不兼容这种配置方式吗? #3477

Closed Daibhid666 closed 3 years ago

Daibhid666 commented 3 years ago

@nobodyiam dubbo相关配置配在application.properties里时是可以正常运行的 现在dubbo的相关配置都迁移到apollo配置中心了 就报上面的错误了 该试的情况我都尝试过了 都没发现原因 难道是因为项目里dubbo是以xml形式配置的 apollo不兼容这种配置方式吗?

Originally posted by @SymonLin in https://github.com/ctripcorp/apollo/issues/1600#issuecomment-432887311 你好我也有同样的问题 springboot2.1.5 apollo-client1.1.1 放在本地根配置文件可以,到apollo上就找不到配置了

nobodyiam commented 3 years ago

apollo 只和 spring 打交道,至于 dubbo 是用 xml 配置还是 java config 配置都是没关系的,#1600 应该描述得比较清楚了,如果还有问题可以提交一个简单的demo看看

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

yuxiao97 commented 3 years ago

You can see this:https://xobo.org/spring-boot-apollo-dubbo-xml-error, My Components version:

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.1.1.RELEASE</version>
</dependency>
<dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>2.7.2</version>
</dependency>
<dependency>
    <groupId>com.ctrip.framework.apollo</groupId>
    <artifactId>apollo-client</artifactId>
    <version>1.7.0</version>
</dependency>

Use xml config dubbo,application.properties like this

#apollo
app.id=my-demo
apollo.bootstrap.enabled=true
apollo.meta=xxx
apollo.property.order.enable=true
apollo.bootstrap.namespaces=application

Use above config start application, start failed, error stacks:

Caused by: java.lang.IllegalStateException: No application config found or it's not a valid config! Please add <dubbo:application name="..." /> to your spring config.
    at org.apache.dubbo.config.utils.ConfigValidationUtils.validateApplicationConfig(ConfigValidationUtils.java:371)
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.checkGlobalConfigs(DubboBootstrap.java:528)
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.initialize(DubboBootstrap.java:515)
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.init(DubboBootstrap.java:496)
    at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:190)
    at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:158)
    at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:68)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
    ... 41 common frames omitted

According to the tips in the previous article, add the following configuration

apollo.bootstrap.eagerLoad.enabled=true

Surprises!

stale[bot] commented 3 years ago

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.