You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zzqsy (GitHub)" <gi...@apache.org> on 2020/02/25 05:21:27 UTC

[GitHub] [dubbo] zzqsy opened issue #5793: 2.7.5版本无法读取到xml文件中的dubbo:application名

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
    <dubbo:application name="spring-dubbo-consumer"/>

    <dubbo:reference id="twoservice" interface="com.zzq.dubbo.service.MyDubboService" url="dubbo://localhost:20880"/>
</beans>

Expection:
No application config found or it's not a valid config! Please add <dubbo:application name="..." /> to your spring config.

debug中 org.apache.dubbo.config.ApplicationConfig#isValid()-----name是null


[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] chickenlj commented on issue #5793: 2.7.5版本无法读取到xml文件中的dubbo:application名

Posted by "chickenlj (GitHub)" <gi...@apache.org>.
Thanks for the feedback. We'll look at the jdk11 issue.

[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] Huangxuny1 commented on issue #5793: jdk11, No application config found or it's not a valid config!

Posted by "Huangxuny1 (GitHub)" <gi...@apache.org>.
@chickenlj   I investigate the issue in jdk11 ,  It's becase of `@PostConstruct`

in [I can't use @PostConstruct and @PostDestroy with Java 11](https://stackoverflow.com/questions/52701459/i-cant-use-postconstruct-and-postdestroy-with-java-11)

> Note that both @PostConstruct and @PreDestroy annotations are part of Java EE. And since Java EE has been deprecated in Java 9 and removed in Java 11 we have to add an additional dependency to use these annotations:

however , application name inject by 
```
@Parameter(key = APPLICATION_KEY, required = true, useKeyAsProperty = false)
    public String getName() {
        return name;
    }
```

and in [AbstractConfig.java](https://github.com/apache/dubbo/blob/d55f062fe77ea0f6a4c913d2418113297ff8403d/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L577)
```
    @PostConstruct
    public void addIntoConfigManager() {
        ApplicationModel.getConfigManager().addConfig(this);
    }
```
this method won't be invoked , so It's will throw
> No application config found or it's not a valid config! Please add <dubbo:application name="..." /> to your spring config.

I try to add dependency to my project
```
<dependency>
         <groupId>javax.annotation</groupId>
         <artifactId>javax.annotation-api</artifactId>
         <version>1.3.2</version>
</dependency>
```

it works .

So... do you have some advice to resolve it ?

[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] slievrly commented on issue #5793: 2.7.5版本无法读取到xml文件中的dubbo:application名

Posted by "slievrly (GitHub)" <gi...@apache.org>.
@zzqsy I could not reproduce this problem in a local test.

[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] Huangxuny1 commented on issue #5793: jdk11, No application config found or it's not a valid config!

Posted by "Huangxuny1 (GitHub)" <gi...@apache.org>.
@chickenlj   I investigate the issue in jdk11 ,  It's becase of `@PostConstruct` (`javax.annotation.PostConstruct`)

in [I can't use @PostConstruct and @PostDestroy with Java 11](https://stackoverflow.com/questions/52701459/i-cant-use-postconstruct-and-postdestroy-with-java-11)

> Note that both @PostConstruct and @PreDestroy annotations are part of Java EE. And since Java EE has been deprecated in Java 9 and removed in Java 11 we have to add an additional dependency to use these annotations:

however , application name inject by 
```
@Parameter(key = APPLICATION_KEY, required = true, useKeyAsProperty = false)
    public String getName() {
        return name;
    }
```

and in [AbstractConfig.java](https://github.com/apache/dubbo/blob/d55f062fe77ea0f6a4c913d2418113297ff8403d/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L577)
```
    @PostConstruct
    public void addIntoConfigManager() {
        ApplicationModel.getConfigManager().addConfig(this);
    }
```
this method won't be invoked , so It's will throw
> No application config found or it's not a valid config! Please add <dubbo:application name="..." /> to your spring config.

[ConfigValidationUtils .java](https://github.com/apache/dubbo/blob/53dca537089441e84160391c8f7efd7b40dd9155/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java#L371)
```
  if (!config.isValid()) {
            throw new IllegalStateException("No application config found or it's not a valid config! " +
                    "Please add <dubbo:application name=\"...\" /> to your spring config.");
        }
```


I try to add dependency to my project
```
<dependency>
         <groupId>javax.annotation</groupId>
         <artifactId>javax.annotation-api</artifactId>
         <version>1.3.2</version>
</dependency>
```

it works .

So... do you have some advice to resolve it ?




[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] Huangxuny1 commented on issue #5793: jdk11, No application config found or it's not a valid config!

Posted by "Huangxuny1 (GitHub)" <gi...@apache.org>.
@chickenlj   I investigate the issue in jdk11 ,  It's becase of `@PostConstruct`

in [I can't use @PostConstruct and @PostDestroy with Java 11](https://stackoverflow.com/questions/52701459/i-cant-use-postconstruct-and-postdestroy-with-java-11)

> Note that both @PostConstruct and @PreDestroy annotations are part of Java EE. And since Java EE has been deprecated in Java 9 and removed in Java 11 we have to add an additional dependency to use these annotations:

however , application name inject by 
```
@Parameter(key = APPLICATION_KEY, required = true, useKeyAsProperty = false)
    public String getName() {
        return name;
    }
```

and in [AbstractConfig.java](https://github.com/apache/dubbo/blob/d55f062fe77ea0f6a4c913d2418113297ff8403d/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L577)
```
    @PostConstruct
    public void addIntoConfigManager() {
        ApplicationModel.getConfigManager().addConfig(this);
    }
```
this method won't be invoked , so It's will throw
> No application config found or it's not a valid config! Please add <dubbo:application name="..." /> to your spring config.

I try to add dependency to my project
```
<dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
```

it works .

So... do you have some advice to resolve it ?

[ Full content available at: https://github.com/apache/dubbo/issues/5793 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org