You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "hyberbin (GitHub)" <gi...@apache.org> on 2019/10/18 04:08:12 UTC
[GitHub] [dubbo] hyberbin opened issue #5190: dubbo 2.7.3 @Reference group参数不生效
### Environment
* Dubbo version: 2.7.3
* Operating System version: *
* Java version: 1.8
### Steps to reproduce this issue
1. 在Consumer端以注解方式配置
```java
@Reference(group = "aaaa")
private XXXService service1;
@Reference(group = "bbbb")
private XXXService service2;
```
2. 调用时候报错
找不到服务
3. 去掉group能通
```java
@Reference
private XXXService service1;
```
4.我自己的解决方案,手动带上Attachment也能通
```java
try {
RpcContext.getContext().setAttachment("group", "aaa");
return service1.xxx();
} finally {
RpcContext.getContext().removeAttachment("group");
}
```
Pls. provide [GitHub address] to reproduce this issue.
### Expected Result
理论上说group配置后应该能调通,不应该手动setAttachment
### Actual Result
```java
String serviceKey = serviceKey(port, path, inv.getAttachments().get(VERSION_KEY), inv.getAttachments().get(GROUP_KEY));
DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get(serviceKey);
if (exporter == null) {
throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " +
", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:" + inv);
}
inv.getAttachments().get(GROUP_KEY) is null
```
```
12:02:42.983 [http-nio-8080-exec-2] ERROR o.p.h.license.LicenseController - Failed to invoke remote method: xxx, provider: dubbo://localhost:12345/xxxx?application=xxx&check=false&interface=xxxx.common.service.LicenseService&lazy=false&pid=18076&qos.enable=false®ister.ip=192.168.31.118&remote.application=&retries=0&side=consumer&sticky=false&timeout=5000&url=dubbo://localhost:12345, cause: org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: xxxx.common.service.LicenseService:12345 in [ ... aaa/xxxx.common.service.LicenseService:12345, ...], may be version or group mismatch , channel: consumer: /192.168.31.118:52787 --> provider: /192.168.31.118:12345, message:RpcInvocation [methodName=getLicenseInfo, parameterTypes=[], arguments=[], attachments={path=xxxx.common.service.LicenseService, input=271, dubbo=2.0.2, interface=xxxx.common.service.LicenseService, version=0.0.0, lang_locale=zh_CN, timeout=5000}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: xxxx.common.service.LicenseService:12345 in [... aaa/xxxx.common.service.LicenseService:12345,...], may be version or group mismatch , channel: consumer: /192.168.31.118:52787 --> provider: /192.168.31.118:12345, message:RpcInvocation [methodName=getLicenseInfo, parameterTypes=[], arguments=[], attachments={path=xxxx.common.service.LicenseService, input=271, dubbo=2.0.2, interface=xxxx.common.service.LicenseService, version=0.0.0, lang_locale=zh_CN, timeout=5000}]
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:266)
at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:127)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:102)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:193)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```
[ Full content available at: https://github.com/apache/dubbo/issues/5190 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] lkj41110 commented on issue #5190: dubbo 2.7.3 @Reference group参数不生效
Posted by "lkj41110 (GitHub)" <gi...@apache.org>.
本地试了下,好像没有办法重现你说的问题。
```
/dubbo/xxx.common.service.LicenseService/providers
/dubbo/xxx.common.service.LicenseService/consumers
```
当加group属性后,提供者和消费者的都会增加对应的group属性。
且消费者调用过程中,会在放入group属性。
看你的描述很有可能是调用过程group丢失了。
[ Full content available at: https://github.com/apache/dubbo/issues/5190 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] hyberbin closed issue #5190: dubbo 2.7.3 @Reference group参数不生效
Posted by "hyberbin (GitHub)" <gi...@apache.org>.
[ issue closed by hyberbin ]
[ Full content available at: https://github.com/apache/dubbo/issues/5190 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] lkj41110 commented on issue #5190: dubbo 2.7.3 @Reference group参数不生效
Posted by "lkj41110 (GitHub)" <gi...@apache.org>.
sorry,应该是AbstractInvoker.invoke
```
if (CollectionUtils.isNotEmptyMap(attachment)) {
//理论上,会把interface,group,token ,timeout 放进去
invocation.addAttachmentsIfAbsent(attachment);
}
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
if (CollectionUtils.isNotEmptyMap(contextAttachments)) {
invocation.addAttachments(contextAttachments);
}
```
[ Full content available at: https://github.com/apache/dubbo/issues/5190 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] lkj41110 commented on issue #5190: dubbo 2.7.3 @Reference group参数不生效
Posted by "lkj41110 (GitHub)" <gi...@apache.org>.
本地试了下,好像没有办法重现你说的问题。
```
/dubbo/xxx.common.service.LicenseService/providers
/dubbo/xxx.common.service.LicenseService/consumers
```
当加group属性后,提供者和消费者的都会增加对应的group属性。
且消费者调用过程中,会在ConsumerContextFilter.invoke中放入group属性。
看你的描述很有可能是调用过程group丢失了。
[ Full content available at: https://github.com/apache/dubbo/issues/5190 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org