thubbo / jmeter-plugins-for-apache-dubbo

Dubbo Plugin for Apache JMeter, It is a plug-in developed for testing Dubbo in Jmeter.
Apache License 2.0
565 stars 290 forks source link

Not found exported service when using group #140

Closed CJSoldier closed 3 years ago

CJSoldier commented 3 years ago

For some reason, I have to configure different group with identical interface and ref like this:

<dubbo:service interface="com.xx.AAA" ref="aaa" group="one" retries="0" timeout="1000" />
<dubbo:service interface="com.xx.AAA" ref="aaa" group="two" retries="0" timeout="1000" />
<dubbo:service interface="com.xx.AAA" ref="aaa" group="three" retries="0" timeout="1000" />

Group one can be successfully invoked but the others failed. Here's the error info:

com.alibaba.dubbo.remoting.RemotingException: Not found exported service: two/com.xx.AA:20880 
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:205)
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:76)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:168)
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:50)
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:79)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I managed to call group two with interface plusing number like this:

interface: com.xx.AAA  group: one
interface: com.xx.AAA2  group: two
interface: com.xx.AAA3  group: three

When calling group two from spring project, the number after interface name is not required. I'm not sure if this is a bug or spring did some special work.

ningyu1 commented 3 years ago

@CJSoldier 你使用的注册中心是什么? 接口是否有版本号? 客户端和服务端分别使用的dubbo版本号是多少?

CJSoldier commented 3 years ago

注册中心是zk, 接口没有版本号。 服务端dubbo是2.5.3,换成2.6.0效果是一样的。

客户端用的是jmeter+dubbo插件。两个版本都试过,效果是一样的: jmeter5.0+jmeter-plugins-dubbo-1.3.6-jar-with-dependencies jmeter5.3+jmeter-plugins-dubbo-2.7.8-jar-with-dependencies

group one 可以直接调通 com.xx.AA#method, 但是group two、group three 必须在接口后面加上数字才能调通。 com.xx.AA2#method, com.xx.AA3#method

在本地启动服务端,不注册到zk, telnet 127.0.0.1查看dubbo服务,里面显示的就是 com.xx.AA、com.xx.AA2、com.xx.AA3 如果注册到zk,zk的节点名称是 com.xx.AA,但是providers节点下接口的名称显示的也是com.xx.AA、com.xx.AA2、com.xx.AA3

使用spring+dubbo客户端,可以使用com.xx.AA#method直接就可以调通另外两个分组:group two, group three, 使用Jmeter的时候就必须在接口前面加数字。

ningyu1 commented 3 years ago

@CJSoldier 老版本服务端用新版本的客户端发起访问在2.7.5之后是存在问题的,使用兼容版本

https://github.com/apache/dubbo/pull/6806 https://github.com/apache/dubbo/issues/6694

CJSoldier commented 3 years ago

感谢回复。我试了兼容版本也不行 这个问题困扰了我好多天,跟踪源码看了一下,插件没问题,是dubbo做了特殊处理。 https://github.com/apache/dubbo/blob/master/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/schema/DubboBeanDefinitionParser.java#L101

如果配配置过id,接口名称相同的时候会自动加上数字。

解决办法:配置的时候加上id区分一下就可以了:

<dubbo:service id="aa" interface="com.xx.AAA" ref="aaa" group="one" retries="0" timeout="1000" />
<dubbo:service id="bb" interface="com.xx.AAA" ref="aaa" group="two" retries="0" timeout="1000" />
<dubbo:service id="cc" interface="com.xx.AAA" ref="aaa" group="three" retries="0" timeout="1000" />
ningyu1 commented 3 years ago

👍 感谢分享调试细节