apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.52k stars 26.43k forks source link

java.lang.ClassNotFoundException: io.grpc.ClientStreamTracer$InternalLimitedInfoFactory #11972

Closed lbhfuture closed 1 year ago

lbhfuture commented 1 year ago

Environment

Steps to reproduce this issue

  1. 在 Kubernetes 以 Proxyless 方式中部署,已经引入了 dubbo-xds 依赖,报找不到
    2023-03-30T09:55:28.223Z  INFO 1 --- [           main] o.a.d.remoting.transport.AbstractServer  :  [DUBBO] Start NettyPortUnificationServer bind /0.0.0.0:50051, export /[0:0:0:0:0:0:0:0]:50051, dubbo version: 3.2.0-beta.5, current host: 10.244.2.43
    2023-03-30T09:55:28.268Z  INFO 1 --- [           main] o.a.d.r.c.m.store.MetaCacheManager       :  [DUBBO] Successfully loaded meta cache from file .metadata.organization-producer.xds.istiod.istio-system.svc:15012, entries 0, dubbo version: 3.2.0-beta.5, current host: 10.244.2.43
    Exception in thread "grpc-default-executor-1" java.lang.NoClassDefFoundError: io/grpc/ClientStreamTracer$InternalLimitedInfoFactory
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at io.grpc.internal.ManagedChannelImpl$ChannelStreamProvider.newStream(ManagedChannelImpl.java:594)
    at io.grpc.internal.ClientCallImpl.startInternal(ClientCallImpl.java:256)
    at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:189)
    at io.grpc.internal.DelayedClientCall$1.run(DelayedClientCall.java:180)
    at io.grpc.internal.DelayedClientCall.drainPendingCalls(DelayedClientCall.java:278)
    at io.grpc.internal.DelayedClientCall.setCall(DelayedClientCall.java:152)
    at io.grpc.internal.ManagedChannelImpl$RealChannel$PendingCall$1.run(ManagedChannelImpl.java:1110)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
    Caused by: java.lang.ClassNotFoundException: io.grpc.ClientStreamTracer$InternalLimitedInfoFactory
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 21 more
  2. 查看 grpc-api 包里的 ClientStreamTracer 类,里面没有 InternalLimitedInfoFactory, grpc-api 由 dubbo-xds 引入,版本是 1.48.1

Pls. provide [GitHub address] to reproduce this issue.

Expected Behavior

Actual Behavior

If there is an exception, please attach the exception trace:

Just put your stack trace here!
AlbumenJ commented 1 year ago

@aamingaa PTAL

lbhfuture commented 1 year ago

我查看了一下 dubbo-xds 的依赖关系,发现其通过 grpc-netty-shaded:1.41.0 引入了对应版本的 grpc-api,然后又通过 grpc-protobuf:1.48.1 和 grpc-stub:1.48.1 引入了对应版本的 grpc-api,在新版的 api 中 使用的是 io.grpc.ClientStreamTracer$Factory

lbhfuture commented 1 year ago

把 grpc-netty-shaded 升级到 1.48.1 后问题解决了,版本冲突的问题。