Code Monkey home page Code Monkey logo

node-zookeeper-dubbo's People

Contributors

caomu avatar justinyueh avatar omnip620 avatar proxy-rock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-zookeeper-dubbo's Issues

关于2.8.4(dubbox)的一些问题

陆陆续续一直有朋友提出关于2.8.4版本的使用问题,起初做这个库的时候我们java端全都是用的原生dubbo,所以并没有做太多关于dubbox的工作,后来随着本库曝光率、使用率的提高,越来越多的小伙伴提出相关问题、需求,但是囿于目前阶段人手有限等一些其它因素,我们无法保证投入足够的时间去做适配,所以就有了一些热心的同学提pr,力图解决和dubbox的通信问题,但之后还是有反馈说其实dubbox依旧无法正常通信(原因可能有很多种,环境配置不同,各种参数的判断不一致等等)。造成了一定的困惑,所以这个issue的目的就是告诉大家。

首先,限于人手等其它问题,原作者团队可能无法保证立即进行适配dubbox的工作,初步计划可能要到18年1月份会正式开始。

其次,如果有朋友等不及,想提pr的话,请务必充分测试保证可用性,毕竟既然有多于一个的团队在使用这个库,对所提交的代码负责是很有必要的。

最后,到1月份会有两种情况,1、假如有pr的话,我们会认真细致的对所提交的代码做测试工作,最大化保证可用性。2、没有的话,我们会投入足够的时间解决和dubbox的通信问题。

所以,希望大家有关于dubbox的问题都在这里提问,不要再开其它issue了。感谢大家的支持关注。🙏
#50 #42 #19

总是报TypeError: Dubbo.Foo.say is not a function

const customerObj = {
$class: 'com.xxx.XXXDTO',
$: {
a: 1,
b: 'test',
c: {$class: 'java.lang.Long', $: 123}
}
};
这个对象里面的参数是什么?
已有初始化完毕标志:Dubbo service init done
总是报TypeError: Dubbo.Foo.say is not a function

dependencies中多个interface问题

我最近遇到一个问题,希望大神给我指点一二:
dependencies:{
Role: {interface: 'vmacro.surface.RoleService', version: '1.0.0', timeout: 6000},
User:{interface:'vmacro.surface.UserService',version:'1.0.0',timeout:6000}
}
我这样的时候会报错:Reg consumer failed :Exception :NO_NODE[-101]
如果这样的话
dependencies:{
Role: {interface: 'vmacro.surface.RoleService', version: '1.0.0', timeout: 6000}
}
就不会报错这个是怎么回事儿呀,老版本,比较急呀,麻烦了

调取服务怎么传递枚举类型

image

这个是我传递的参数, 其中orderStatus是一个枚举参数

我这样子传递orderStatus,就报错了,
image

怎么chu传递枚举类型?求支持

Fail to decode request due to: RpcInvocation

完整的错误是:
Fail to decode request due to: RpcInvocation[methodName=getAvailableQuickPayBankMap, parameterTypes=[], arguments=null, attachments={dubbo=2.8.4, input=220, path=com.njq.nongfadai.service.IBankService, version=1.0.0}

代码:

const nzd = require('node-zookeeper-dubbo');
const app = require('express')();
const opt = {
  application: {
    name: 'nongfadai-dubbo-provider'
  },
  register: '10.1.60.23:2181',
  dubboVer: '2.8.4',
  root: 'dubbo',
  dependencies: {
    IBankService: {
      interface: 'com.njq.nongfadai.service.IBankService',
      version: '1.0.0',
      timeout: 30000
    }
  }
};
//转换类型使用的例子:https://github.com/node-modules/js-to-java
opt.java = require('js-to-java');

const Dubbo = new nzd(opt);

//无参数的例子
app.get('/IBankService/getAvailableQuickPayBankMap', (req, res) => {
  Dubbo.IBankService
    .getAvailableQuickPayBankMap()
    .then(data => {
      res.send(data);
    })
    .catch(err => {
      res.send(err);
    });
});

app.listen(9090);

这个接口不需要参数http://localhost:9090/IBankService/getAvailableQuickPayBankMap

使用的版本:
[email protected]
dubbox 2.8.4
node 6.10.2

你好

你好,我在使用的时候发现在反序列化的时候,对象层级深一点的,反序列化会报错。
[TypeError: Cannot read property 'toString' of undefined]
希望能够解决一下。

请问int[]怎么传参

Dubbo.interface.method(java.array('int', [1,2,3]));

我这报错Fail to decode request due to: RpcInvocation

node-zookeeper-dubbo服务启动报错

各位大牛,新入手node ,求指导!
代码如下 :
var opt = {
application: { name: 'df' },
register: '28.163.1.188:2181',
root: 'dubbo',
dependencies: {
WcnService: {
interface: 'com.foundersc.crm.mobile.service.AppointRemoteService',
version: '1.0.1',
timeout: 6000,
group: 'test',
methodSignature: {
getbrokerAccountCnt = (userId) => (java) => [java.String(userId)],
}
}
}
};

启动时报错:

E:\Fouder\nodeWorkspace\node_ws_demo\bin\www:49
getbrokerAccountCnt = (userId) => (java) => [java.String(userId)],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Invalid shorthand property initializer
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
不知道是哪个地方配错了 ,我参考网上的模板来写的 。麻烦大牛来指导下。十分感谢!

connection close

调用时发生这个异常:

equest
Connection: close
Server: Jetty(6.1.26)

关于dubbo的version参数的设置遇到问题

index.js第104行 if (zoo.version === self._version && zoo.group === self._group) {

当dubbo协议的服务的zoo里没有传入version参数时,就是那个dubbo://的url里的version参数,这个判断就通不过。
在我们这里java那边把版本信息传作了dubbo参数,即非version=2.4.9而是dubbo=2.4.9
然后我把它改作 if (zoo.dubbo === self._version && zoo.group === self._group) {通过了这个判断,但是远程调用时报错

com.alibaba.dubbo.remoting.RemotingException: Not found exported service: com.**.**.api.**Service:2.4.9:20875 in [com.**.**.api.**Service:20875, com.**.**.api.**Service:20875, com.**.**.api.**Service:20875], may be version or group mismatch , channel: consumer: /172.19.5.159:59617 --> provider: /172.19.5.14:20875, message:RpcInvocation [methodName=**method, parameterTypes=[long], arguments=[11446], attachments={dubbo=2.4.9, input=187, path=com.**.**.api.**Service, interface=com.**.**.api.**Service, timeout=6000, version=2.4.9}]
com.alibaba.dubbo.remoting.RemotingException: Not found exported service: com.**.**.api.**Service:2.4.9:20875 in [com.**.**.api.**Service:20875, com.**.**.api.**Service:20875, com.**.**.api.**Service:20875], may be version or group mismatch , channel: consumer: /172.19.5.159:59617 --> provider: /172.19.5.14:20875, message:RpcInvocation [methodName=**method, parameterTypes=[long], arguments=[11446], attachments={dubbo=2.4.9, input=187, path=com.**.**.api.**Service, interface=com.**.**.api.**Service, timeout=6000, version=2.4.9}]
        at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.getInvoker(DubboProtocol.java:217)
        at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:86)
        at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)
        at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)
        at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
        at com.alibaba.dubbo.remoting.transport.dispather.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

最后我的解决方案:

  1. 在index.js的第65行插入this._revision = depend.revision;
  2. 将104行的条件判断改为if (zoo.revision === self._revision && zoo.group === self._group) {
  3. 入口参数配置
dependencies: {
  **Service: {
    interface: "com.**.**.api.**Service",
    // version: "2.4.9",
    revision: "2.0-SNAPSHOT",
    methodSignature: {
      **method(id){
        return [java.long(id)];
      }
    }
  }
}

远程调用com.**.**.api.**Service中的**method成功。

大神,要不在入口调整下参数配置方式之类的,能让其他遇到我这种情况下不改源码的方式来处理这种问题?我不懂java,所以为什么我这么改了java那边就能调通了,也不知道原因,就只好先将就了,不过肯定不是长久之计。希望可以帮助一下我,感激不尽。
@p412726700

Error: string is not valid UTF-8 encode

成功调用后台的方法,返值为String类型,可是前端返回下面的错误,是什么原因呢
我找到\hessian.js\lib\utils.js文件中找到

exports.lengthOfUTF8 = function (head) {
    debugger;
  if (head < 0x80) {
    return 1;
  }
  if ((head & 0xe0) === 0xc0) {
    return 2;
  }

  if ((head & 0xf0) === 0xe0) {
    return 3;
  }
  throw new Error('string is not valid UTF-8 encode');
};

Fail to decode request due to: RpcInvocation

找到错误提示的原因说可能是:
1.传输的参数没有实现序列化接口(包括内部的对象属性);
2.传输的参数中是否包含了不能序列化的属性,例如ImmutableList、Joda DateTime

而传参数对象为

{ '$class': 'com.user.dto.LoginUser',
  '$':
   { id: '100018577',
     mainId: 100018577,
     account: null,
     email: '[email protected]',
     mobile: '51807',
     posts: [ '经办岗' ],
     activate: true,
     shopId: null,
     roles: [],
     name: '经办岗'} }

调用代码为

Dubbo.UserReadService
    .getUserInfo({'$class': 'com.user.dto.LoginUser', '$':user})

err处理问题

client.on('error', function (err) {
self._execute(method, args, host);
});
如果服务端口变了,就会触发error,这样写就会一直错下去,不会有返回值,是不是去重新获取一下zk上注册的provider,然后再试一次,不行抛异常呢?

cd

配置参数 env 是什么?

跑demo遇到的问题

你好,
const customerObj = {
$class: 'vmacro.surface.UserService',
$: {
a: 1,
b: 'selectByPrimaryKey', //这个是方法名吗
c: {$class: 'java.lang.Long', $: 1}
}
};
这里是配置一个类的所有属性???
console.log(Dubbo)
Dubbo.User
.selectByPrimaryKey({'$class': 'java.lang.Long', '$': '10000000'},customerObj)
.then(console.log(customerObj))
.catch(console.error)
这一块应该怎么配置User.selectByPrimaryKey始终报错不是函数

Reg consumer failed:NO_NODE: Exception: NO_NODE[-101]

现象:
每次JAVA端提供好了接口,然后node端把接口配置进去然后调用时,就报这个错误。
看了一下此时zookeeper上没有consumers目录,当java使用了该接口之后,zookeeper上出现了consumers目录, 然后node端就可以使用该接口了。

每次java端提供新的接口时都会出现这种情况

new Service的时候报错

var Service=require('node-zookeeper-dubbo');
var opt={
gruop:'dubbo', // dubbo group default by 'dubbo',optional
conn:'192.168.2.138:20880', // zookeeper url
path:'com.service.dubbo.provider.ParamService', // service url
}
var service = new Service(opt);
在 new Service的时候报错了:
throw new assert.AssertionError({^
AssertionError: connectionString must be an non-empty string.
请问是什么原因呢?

请教关于使用这个模块的一些周边问题

我们准备使用 node-zookeeper-dubbo 解决node与java service之间通信的问题,简单跑通 demo 后有些迷惑在 node 这边需要这样一对一的创建 java 提供的接口吗?有没有方便的途径可以创建这些对应的接口执行函数?或者还有什么周边模块一起使用才能高效?期盼你分享在实际使用中的情况。谢谢。

Getting more done in GitHub with ZenHub

Hola! @p412726700 has created a ZenHub account for the p412726700 organization. ZenHub is the leading team collaboration and project management solution built for GitHub.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • “+1” button for GitHub issues and comments;
  • Drag-and-drop file sharing;
  • Time-saving shortcuts like a quick repo switcher.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @p412726700.

ZenHub Board

调用时Connection: close

dubbo 版本:2.5.3
node-zookeeper-dubbo版本: 1.7.28

node端控制台提示:

equest
Connection: close
Server: Jetty(6.1.26)

node处理代码:

var express = require('express');
var router = express.Router();
var Service = require('node-zookeeper-dubbo');
var opt = {
    env: '1.0',
    group: 'test',
    conn: '127.0.0.1:2181',
    path: 'com.xy.demo.service.HelloWorldService',
    version: '2.5.3'
};


router.post('/test', function (req, res) {
    //调用dubbo服务
    var method = "hello1";//方法名
    var arg1 = {$class: 'java.lang.String', $: 'test'};
    var args = [arg1];//参数数组
    var service = new Service(opt);//连接zk
    service.excute(method, args, function (err, data) {
        if (err) {
            console.log(err);
            return res.send('error');
        }
        //返回成功
        return res.send('success');
    });
});

module.exports = router;

java代码:

<!-- 具体的实现bean -->
    <bean id="helloWorldService" class="com.xy.demo.service.impl.HelloWorldServiceImpl" />
    <!-- 提供方应用信息,用于计算依赖关系 -->
    <dubbo:application name="provider-hello"  />
    <!-- 使用zookeeper注册中心暴露服务地址 -->
    <dubbo:registry address="zookeeper://127.0.0.1:2181" />
    <!-- 用dubbo协议在20880端口暴露服务 -->
    <dubbo:protocol name="hessian" port="20880" />
    <!-- 声明需要暴露的服务接口 -->
    <dubbo:service interface="com.xy.demo.service.HelloWorldService" ref="helloWorldService" version="1.0"/>
public interface HelloWorldService {
    void hello1(String name);
}

public class HelloWorldServiceImpl implements HelloWorldService {
    public void hello1(String name) {
        System.out.println("hello1, " + name);
    }
}

Dubbo service init done TypeError: Dubbo.FOO.sayHello is not a function

什么情况?

const nzd=require('node-zookeeper-dubbo');
const app=require('express')();
const opt={
application:{name:'hello-world-app'},
register:'localhost:2181',
root:'dubbo',
dependencies:{
FOO:{interface:'com.mor.server.dubbo.service.DemoServer',version:'LATEST',timeout:6000}
}
}
const Dubbo=new nzd(opt);
var arg1={$class:'java.lang.String',$:'13100000001'}//参数1
var args=[arg1];//参数数组
app.get('/foo',function(req,res){
Dubbo.FOO.sayHello(args)
.then(function(data){
res.send(data);
}).catch(function(err){
res.send(err);
});
})

app.listen(9090)

Service.prototype._find方法报错

由于this._zk.getChildren(/${this._root}/${path}/providers, watch, handleResult);
this._root不正确导致链接错误,应该在Serivce的构造方法显示传递root,
var Service = function (zk, dubboVer, depend, root)

对象内部还有对象的情况会报序列化错误

比如
比如

{
"$class":"com.xxx.RandomAmountBindingApplyDto",
"$":{
"userName":"张三",
"customerType":{
"$class":"com.xxx.CustomerType",
"$":{
"code":"0",
"chineseName":"个人"
}
}
}
}
里面的有一个customerType属性也是一个对象
会报:ail to decode request due to: RpcInvocation

Exception: CONNECTION_LOSS

服务运行期间 出现异常CONNECTION_LOSS: Exception: CONNECTION_LOSS[-4]。。。
然后再调用请求会提示method not function.
应用如何捕获 该异常, 如何处理异常。

判断为空的问题

if (heap[15] === 3 && heap.length < 20) { // 判断是否没有返回值
不能捕获到为空的情况

报Cannot read property 'split' of undefined

您好,在您的项目中index.js中报错TypeError: Cannot read property 'split' of undefined
at /home/rd-web/node_modules/node-zookeeper-dubbo/index.js:145:71
at Service._execute (/home/rd-web/node_modules/node-zookeeper-dubbo/index.js:143:10)
.......
看了下代码,是查找host时出错,一般是zookeeper没有提供服务报这种错误,但是我们的服务是一直启动的,重启现在的项目就可以了正常访问了 ,不知道还有什么原因导致这个结果,服务项目是分布式springboot项目。
问下 这个问题还有什么原因导致?

请问支持dubbo原生协议的嘛

我们公司现在是这个场景,服务端有一堆dubbo服务,现在想切换成node中间层,但是老的服务端不想进行改造.请问现在可以支持嘛,支持的话,哪个版本比较稳定

请问String数组类型如何传参

var arg1={$class:'java.lang.StringArray',$:['a','b']};
var arg2={$class:'java.lang.String[]',$:['a','b']};
var arg3=java.String(['a']);
var arg4=java,array('String', [1, 2, 3]);

以上方法都试了,均为dubbo接口返回错误,求教!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.