Hi,
I have implemented gRPC in my applications.
I have created 3 modules:
Module1: Generate protobuf files
Module2: Construct gRPC server
Module3: Construct gRPC client
Here, I'm using zookeeper for the load balancing.
Following dependencies have been added to the module1.
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>
Following dependencies have been added to the module2 and Module3.
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-grpclb</artifactId>
<version>1.10.0</version>
<type>jar</type>
</dependency>
On application restart both grpc server and client are being connected to the zookeeper. I can see the grpc server listening on the given port as well.
But, getting below error whenever I'm trying to invoke a rpc.
io.grpc.internal.ManagedChannelImpl$NameResolverListenerImpl$1NamesResolved.run [io.grpc.internal.ManagedChannelImpl-1] Unexpected exception from LoadBalancer
java.lang.NoClassDefFoundError: io/netty/util/AsciiString
at io.grpc.netty.NettyClientTransport.<init>(NettyClientTransport.java:111)
at io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.newClientTransport(NettyChannelBuilder.java:517)
at io.grpc.internal.CallCredentialsApplyingTransportFactory.newClientTransport(CallCredentialsApplyingTransportFactory.java:49)
at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:209)
at io.grpc.internal.InternalSubchannel.obtainActiveTransport(InternalSubchannel.java:188)
at io.grpc.internal.ManagedChannelImpl$SubchannelImpl.requestConnection(ManagedChannelImpl.java:1130)
at io.grpc.util.RoundRobinLoadBalancerFactory$RoundRobinLoadBalancer.handleResolvedAddressGroups(RoundRobinLoadBalancerFactory.java:126)
at io.grpc.internal.ManagedChannelImpl$NameResolverListenerImpl$1NamesResolved.run(ManagedChannelImpl.java:1032)
at io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:73)
at io.grpc.internal.ManagedChannelImpl$4.get(ManagedChannelImpl.java:403)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:238)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1.start(CensusTracingModule.java:386)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1.start(CensusStatsModule.java:679)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:293)
at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:283)
at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:92)
Can anyone help in this.
Regards,
qplc