Stub Proxy 配置 Bug #151

Closed
xiegengcai opened this Issue Aug 18, 2015 · 12 comments

Projects

None yet

9 participants

@xiegengcai

配置描述

文档描述

当定义BarService并定义BarServiceStub时,配置如下其实是不会生效的

<dubbo:service interface="com.foo.BarService" stub="true" />

源码跟踪

com.alibaba.dubbo.config.ServiceConfig#doExport()

if(local !=null){   // 文档中并没有与local相关的参数解释
    if(local=="true"){
        local=interfaceName+"Local";
    }
    Class<?> localClass;
    try {
        localClass = ClassHelper.forNameWithThreadContextClassLoader(local);
    } catch (ClassNotFoundException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
    if(!interfaceClass.isAssignableFrom(localClass)){
        throw new IllegalStateException("The local implemention class " + localClass.getName() + " not implement interface " + interfaceName);
    }
}

if(stub !=null){
    if(stub=="true"){ // 最坑爹的错误是这里,文档说stub="true"默认interfaceName+Local(实际是+Stub,参见下一个注释),可是这是String对象啊,如果外面stub赋值不是stub="true"的话,设置了true也不会进来,应该修改为stub.equals("true"),上面Local也一样
        stub=interfaceName+"Stub";  // 这里文档中的解释有误,文档中写的是+Local,即与上面的Local一致
    }
    Class<?> stubClass;
    try {
        stubClass = ClassHelper.forNameWithThreadContextClassLoader(stub);
    } catch (ClassNotFoundException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
    if(!interfaceClass.isAssignableFrom(stubClass)){
        throw new IllegalStateException("The stub implemention class " + stubClass.getName() + " not implement interface " + interfaceName);
    }
}
@xiegengcai xiegengcai changed the title from Stub Proxy Bug to Stub Proxy 配置 Bug Aug 18, 2015
@rikugun
rikugun commented Mar 7, 2016

我也发现了这个问题, 这里的字符串应该是 "true".equals() 的, 现在只能使用 Stub 类名来代替

@teaey teaey added a commit that closed this issue Mar 19, 2016
@teaey teaey fix #151 c8afdd5
@teaey teaey closed this in c8afdd5 Mar 19, 2016
@xwarrior

有更新了?僵尸项目要复活了么?

@teaey
Member
teaey commented Mar 21, 2016

@xwarrior 准备适应这个时代,把他做的更轻更易用。

@liangz168

@teaey 现在用这个框架会不会已经过时了? HSF有源代码吗?

@yinjun622

@liangz168 你说过时是指架构吗?

@liangz168

@yinjun622 我是询问一下,毕竟3年没有更新过了

@liangz168

@teaey 期待新版本的更新! 加油!

@threezhang

期待

在 2016年3月24日,上午11:09,William.wei notifications@github.com 写道:

@teaey https://github.com/teaey 期待新版本的更新! 加油!


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub #151 (comment)

@slowlizard

期待。dubbo怎么过时?请问怎么加入dubbo源码贡献者?

@teaey
Member
teaey commented Mar 29, 2016

@slowlizard 关键不是怎么成为dubbo的代码贡献者,而是你有没有好的feture。

@rexren
rexren commented Mar 30, 2016

@teaey 能支持etcd和consul作为注册中心吗?

@teaey
Member
teaey commented Apr 6, 2016

@rexren 自己根据注册中心接口实现一套,可是很容易的

@teaey teaey added a commit that referenced this issue Apr 9, 2016
@teaey teaey fix #151 fix #215 07d3b30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment