Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行直接报错了,LZ能帮忙看下么。 #6

Open
IMJacky opened this issue Jan 16, 2021 · 4 comments
Open

运行直接报错了,LZ能帮忙看下么。 #6

IMJacky opened this issue Jan 16, 2021 · 4 comments

Comments

@IMJacky
Copy link

IMJacky commented Jan 16, 2021

Exception in thread "main" java.lang.NullPointerException
at com.pjmike.client.netty.ClientHandler.getRpcResponse(ClientHandler.java:53)
at com.pjmike.client.netty.NettyClient.send(NettyClient.java:102)
at com.pjmike.client.proxy.RpcClientDynamicProxy.invoke(RpcClientDynamicProxy.java:54)
at com.sun.proxy.$Proxy37.hello(Unknown Source)
at com.pjmike.client.ClientApplication.main(ClientApplication.java:18)

@Faoin
Copy link

Faoin commented Mar 10, 2021

按照代码的逻辑,client启动的时候需要加 sync() 阻塞Object.wait,等待异步的 socket 绑定事件完成代码。直接在失败重连那边加上就好

@IMJacky
Copy link
Author

IMJacky commented Mar 10, 2021

按照代码的逻辑,client启动的时候需要加 sync() 阻塞Object.wait,等待异步的 socket 绑定事件完成代码。直接在失败重连那边加上就好

是滴,没错,就是LZ注释掉的那行代码 bootstrap.connect(host, port).sync()

@dwdw666
Copy link

dwdw666 commented Dec 22, 2022

hi,我在加上了这个代码之后任然报错 了 Failed to initialize a channel ,详细信息为 com.pjmike.client.netty.ClientHandler is not a @sharable handler, so can't be added or removed multiple times

@dwdw666
Copy link

dwdw666 commented Dec 23, 2022

这个问题是因为java版本的问题,当我切换到jdk1.8就没有问题了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants