You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/07/20 10:16:04 UTC
[GitHub] [dubbo] qtsj1997 opened a new issue #8324: protobuf协议调用空指针
qtsj1997 opened a new issue #8324:
URL: https://github.com/apache/dubbo/issues/8324
使用tri协议和protobuf序列化调用提供者失败
### Environment
* Dubbo version: 3.0.1
* Operating System version: win10
* Java version: 1.8
* Dubbo go version: v3.0.0-rc2
### Steps to reproduce this issue
1.消费方配置
```yaml
server:
port: 9092
spring:
application:
name: nacosConsumer
dubbo:
application:
metadataType: local
service-discovery:
migration: FORCE_APPLICATION
name: nacosConsumer
registry:
address: nacos://127.0.0.1:8848?registry-type=service
```
2. 测试
```java
@DubboReference(protocol = "tri", timeout = 10000, providedBy = "UserInfoServer")
GreeterProvider greeterImpl;
@Test
public void testTri(){
Helloworld.HelloRequest build = Helloworld.HelloRequest.newBuilder().setName("测试").build();
System.out.println(greeterImpl.SayHello(build).getName());
}
```
3 提供方启动成功并注册到nacos
```go
func main() {
os.Setenv("CONF_PROVIDER_FILE_PATH", "D:\\soft\\go\\go_project\\src\\dubbo-go-simple-demo\\go-server-triple\\conf\\server.yml")
hessian.RegisterPOJO(&pkg.User{})
config.SetProviderService(new(pkg.UserProvider))
config.SetProviderService(pkg.NewGreeterProvider())
config.Load()
inits()
}
```
```go
type GreeterProvider struct {
*protobuf2.GreeterProviderBase
}
func NewGreeterProvider() *GreeterProvider {
return &GreeterProvider{
GreeterProviderBase: &protobuf2.GreeterProviderBase{},
}
}
func (s *GreeterProvider) SayHello(ctx context.Context, in *protobuf2.HelloRequest) (*protobuf2.User, error) {
logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name)
return &protobuf2.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil
}
func (g *GreeterProvider)Reference()string {
return "greeterImpl"
}
```
###config/server.yml
```yml
application:
organization: "dubbo.io"
name: "UserInfoServer"
module: "dubbo-go user-info server"
version: "0.0.1"
environment: "dev"
metadataType: "local"
# registry config
registries:
"demoServiceDiscovery":
protocol: "service-discovery"
params:
service_discovery: "nacos1"
name_mapping: "memory"
metadata: "default"
remote:
nacos:
address: "127.0.0.1:8848"
timeout: "15s"
service_discovery:
nacos1:
protocol: "nacos"
remote_ref: "nacos"
# group: "dubbo"
# service config
services:
"UserProvider":
registry: "demoServiceDiscovery"
protocol: "dubbo"
interface: "org.apache.dubbo.UserProvider"
loadbalance: "random"
warmup: "100"
cluster: "failover"
methods:
- name: "GetUser"
retries: 1
loadbalance: "random"
"greeterImpl":
registry: "demoServiceDiscovery"
protocol: "tri"
interface: "org.apache.dubbo.sample.basic.GreeterProvider"
cluster: "failover"
# protocol config
protocols:
"dubbo":
name: "dubbo"
port: 20002
"tri":
name: "tri"
port: 20010
```
![image](https://user-images.githubusercontent.com/50602333/126302759-e629cec3-5897-4715-8ff4-2d95b11e12bb.png)
### Expected Result
成功获取返回的结果
### Actual Result
空指针
```java
org.apache.dubbo.rpc.RpcException: Failed to invoke the method SayHello in the service org.apache.dubbo.sample.basic.GreeterProvider. Tried 3 times of the providers [192.168.9.191:20010] (1/1) from the registry 127.0.0.1:8848 on the consumer 192.168.9.191 using the dubbo version 3.0.1. Last error is: Failed to invoke remote method: SayHello, provider: DefaultServiceInstance{, serviceName='UserInfoServer', host='192.168.9.191', port=20010, enabled=true, healthy=true, metadata={dubbo.metadata-service.url-params={"application":"UserInfoServer","group":"UserInfoServer","port":"20002","protocol":"dubbo","release":"dubbo-golang-3.0.0","timestamp":"1626764608","version":"1.0.0"}, dubbo.subscribed-services.revision=0, dubbo.endpoints=[{"port":20002,"protocol":"dubbo"},{"port":20010,"protocol":"tri"}], dubbo.metadata.revision=6156228206, dubbo.metadata.storage-type=local, id=192.168.9.191:20010}}, service{name='org.apache.dubbo.sample.basic.GreeterProvider',group='',version='',protocol='tr
i',params={cluster=failover, application=UserInfoServer, release=dubbo-golang-3.0.0, loadbalance=random, timestamp=1626773402},consumerParams={side=consumer, register.ip=192.168.9.191, release=3.0.1, methods=SayHello, qos.port=22289, provided-by=UserInfoServer, dubbo=2.0.2, pid=22620, interface=org.apache.dubbo.sample.basic.GreeterProvider, qos.enable=true, timeout=10000, protocol=tri, metadata-type=local, application=nacosConsumer, sticky=false, timestamp=1626775161328}}, cause: org.apache.dubbo.remoting.RemotingException: java.lang.NullPointerException
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at org.apache.dubbo.rpc.model.ServiceRepository.lookupReferredService(ServiceRepository.java:180)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.writeRequest(TripleClientHandler.java:72)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.write(TripleClientHandler.java:48)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:110)
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:265)
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82)
at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82)
at org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter.invoke(ConsumerContextFilter.java:101)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82)
at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$ClusterFilterInvoker.invoke(AbstractCluster.java:93)
at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:93)
at org.apache.dubbo.registry.client.migration.ServiceDiscoveryMigrationInvoker.invoke(ServiceDiscoveryMigrationInvoker.java:68)
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:95)
at org.apache.dubbo.common.bytecode.proxy1.SayHello(proxy1.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
at com.sun.proxy.$Proxy76.SayHello(Unknown Source)
at com.dflz.TestConsumerDemo.testTri(TestConsumerDemo.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: java.lang.NullPointerException
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at org.apache.dubbo.rpc.model.ServiceRepository.lookupReferredService(ServiceRepository.java:180)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.writeRequest(TripleClientHandler.java:72)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.write(TripleClientHandler.java:48)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928)
at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:181)
at org.apache.dubbo.rpc.protocol.AbstractInvoker.waitForResultIfSync(AbstractInvoker.java:272)
at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:181)
at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invokeWithContext(AbstractClusterInvoker.java:297)
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:79)
... 51 more
Caused by: org.apache.dubbo.remoting.RemotingException: java.lang.NullPointerException
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at org.apache.dubbo.rpc.model.ServiceRepository.lookupReferredService(ServiceRepository.java:180)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.writeRequest(TripleClientHandler.java:72)
at org.apache.dubbo.rpc.protocol.tri.TripleClientHandler.write(TripleClientHandler.java:48)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture2.doReceived(DefaultFuture2.java:167)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture2.received(DefaultFuture2.java:124)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture2.received(DefaultFuture2.java:113)
at org.apache.dubbo.rpc.protocol.tri.TripleInvoker.lambda$doInvoke$1(TripleInvoker.java:121)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)
at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
at io.netty.util.internal.PromiseNotificationUtil.tryFailure(PromiseNotificationUtil.java:64)
at io.netty.channel.AbstractChannelHandlerContext.notifyOutboundHandlerException(AbstractChannelHandlerContext.java:814)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:719)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
```
请问是哪里配置错了吗
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] xiaoheng1 commented on issue #8324: protobuf序列化调用空指针
Posted by GitBox <gi...@apache.org>.
xiaoheng1 commented on issue #8324:
URL: https://github.com/apache/dubbo/issues/8324#issuecomment-884599953
This question seems to be similar to #8265.
You use the latest 3.0 branch code to try.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] qtsj1997 closed issue #8324: protobuf序列化调用空指针
Posted by GitBox <gi...@apache.org>.
qtsj1997 closed issue #8324:
URL: https://github.com/apache/dubbo/issues/8324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] qtsj1997 commented on issue #8324: protobuf序列化调用空指针
Posted by GitBox <gi...@apache.org>.
qtsj1997 commented on issue #8324:
URL: https://github.com/apache/dubbo/issues/8324#issuecomment-884729364
> 这个问题似乎与#8265类似。
>
> 你用最新的3.0分支代码试试。
感谢您的帮助
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org