milvus-io / milvus-sdk-java

Java SDK for Milvus.
https://milvus.io
Apache License 2.0
383 stars 155 forks source link

Attu可以连接到Milvus,但java连接调用milvus报错? #784

Closed ztg25 closed 6 months ago

ztg25 commented 6 months ago

我用Attu可以连接到Milvus,创建了Collection,叫car。但使用springboot + milvus-sdk-java来连接milvus使用出错。 测试代码如下:

public class SimpleExample {
    private static MilvusServiceClient milvusClient = new MilvusServiceClient(ConnectParam.newBuilder()
            .withHost("127.0.0.1")
            .withPort(19530)
            .build());
    public static void main(String[] args) {
        // list collections
        R<Boolean> response = milvusClient.hasCollection(
                HasCollectionParam.newBuilder()
                        .withCollectionName("car")
                        .build());

        System.out.println("milvus status is : " + response.getStatus());
}}}

pom.xml

<dependency>
            <groupId>io.milvus</groupId>
            <artifactId>milvus-sdk-java</artifactId>
            <version>2.3.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

错误日志如下:

/Users/tony/Documents/software/jdk-11.0.18+10/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=51567:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/tony/Documents/Projects/springBoot_demo/target/classes:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.4.RELEASE/spring-boot-starter-web-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.4.RELEASE/spring-boot-starter-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.4.RELEASE/spring-boot-starter-logging-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/tony/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/tony/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/Users/tony/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/Users/tony/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/Users/tony/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/tony/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.4.RELEASE/spring-boot-starter-json-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.8/jackson-datatype-jdk8-2.9.8.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.8/jackson-datatype-jsr310-2.9.8.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.8/jackson-module-parameter-names-2.9.8.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.4.RELEASE/spring-boot-starter-tomcat-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.17/tomcat-embed-core-9.0.17.jar:/Users/tony/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.17/tomcat-embed-el-9.0.17.jar:/Users/tony/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.17/tomcat-embed-websocket-9.0.17.jar:/Users/tony/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.16.Final/hibernate-validator-6.0.16.Final.jar:/Users/tony/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/tony/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/tony/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/tony/.m2/repository/org/springframework/spring-web/5.1.6.RELEASE/spring-web-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-beans/5.1.6.RELEASE/spring-beans-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-webmvc/5.1.6.RELEASE/spring-webmvc-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-aop/5.1.6.RELEASE/spring-aop-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-context/5.1.6.RELEASE/spring-context-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-expression/5.1.6.RELEASE/spring-expression-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-core/5.1.6.RELEASE/spring-core-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/spring-jcl/5.1.6.RELEASE/spring-jcl-5.1.6.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-devtools/2.1.4.RELEASE/spring-boot-devtools-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot/2.1.4.RELEASE/spring-boot-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.4.RELEASE/spring-boot-autoconfigure-2.1.4.RELEASE.jar:/Users/tony/.m2/repository/io/milvus/milvus-sdk-java/2.3.3/milvus-sdk-java-2.3.3.jar:/Users/tony/.m2/repository/io/grpc/grpc-protobuf/1.46.0/grpc-protobuf-1.46.0.jar:/Users/tony/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/tony/.m2/repository/com/google/api/grpc/proto-google-common-protos/2.0.1/proto-google-common-protos-2.0.1.jar:/Users/tony/.m2/repository/io/grpc/grpc-protobuf-lite/1.46.0/grpc-protobuf-lite-1.46.0.jar:/Users/tony/.m2/repository/io/grpc/grpc-stub/1.46.0/grpc-stub-1.46.0.jar:/Users/tony/.m2/repository/com/google/protobuf/protobuf-java/3.19.6/protobuf-java-3.19.6.jar:/Users/tony/.m2/repository/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar:/Users/tony/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/Users/tony/.m2/repository/org/apache/commons/commons-collections4/4.3/commons-collections4-4.3.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/tony/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar:/Users/tony/.m2/repository/com/squareup/okhttp3/okhttp/4.10.0/okhttp-4.10.0.jar:/Users/tony/.m2/repository/com/squareup/okio/okio-jvm/3.0.0/okio-jvm-3.0.0.jar:/Users/tony/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.jar:/Users/tony/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.2.71/kotlin-stdlib-jdk7-1.2.71.jar:/Users/tony/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar:/Users/tony/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.71/kotlin-stdlib-1.2.71.jar:/Users/tony/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.2.71/kotlin-stdlib-common-1.2.71.jar:/Users/tony/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/tony/.m2/repository/com/alibaba/fastjson/1.2.83/fastjson-1.2.83.jar:/Users/tony/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/tony/.m2/repository/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar:/Users/tony/.m2/repository/io/netty/netty-buffer/4.1.107.Final/netty-buffer-4.1.107.Final.jar:/Users/tony/.m2/repository/io/netty/netty-common/4.1.34.Final/netty-common-4.1.34.Final.jar:/Users/tony/.m2/repository/io/grpc/grpc-netty/1.61.0/grpc-netty-1.61.0.jar:/Users/tony/.m2/repository/io/grpc/grpc-api/1.61.0/grpc-api-1.61.0.jar:/Users/tony/.m2/repository/io/netty/netty-codec-http2/4.1.34.Final/netty-codec-http2-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-transport/4.1.34.Final/netty-transport-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-resolver/4.1.34.Final/netty-resolver-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-codec/4.1.34.Final/netty-codec-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-handler/4.1.34.Final/netty-handler-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-codec-http/4.1.34.Final/netty-codec-http-4.1.34.Final.jar:/Users/tony/.m2/repository/io/grpc/grpc-core/1.61.0/grpc-core-1.61.0.jar:/Users/tony/.m2/repository/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4.jar:/Users/tony/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.23/animal-sniffer-annotations-1.23.jar:/Users/tony/.m2/repository/io/grpc/grpc-context/1.61.0/grpc-context-1.61.0.jar:/Users/tony/.m2/repository/io/grpc/grpc-util/1.61.0/grpc-util-1.61.0.jar:/Users/tony/.m2/repository/io/netty/netty-handler-proxy/4.1.34.Final/netty-handler-proxy-4.1.34.Final.jar:/Users/tony/.m2/repository/io/netty/netty-codec-socks/4.1.34.Final/netty-codec-socks-4.1.34.Final.jar:/Users/tony/.m2/repository/com/google/guava/guava/32.1.3-android/guava-32.1.3-android.jar:/Users/tony/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/Users/tony/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/tony/.m2/repository/org/checkerframework/checker-qual/3.37.0/checker-qual-3.37.0.jar:/Users/tony/.m2/repository/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar:/Users/tony/.m2/repository/com/google/errorprone/error_prone_annotations/2.23.0/error_prone_annotations-2.23.0.jar:/Users/tony/.m2/repository/io/perfmark/perfmark-api/0.26.0/perfmark-api-0.26.0.jar:/Users/tony/.m2/repository/io/netty/netty-transport-native-unix-common/4.1.34.Final/netty-transport-native-unix-common-4.1.34.Final.jar com.example.sbm.milvus.SimpleExample
17:05:05.062 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
17:05:05.080 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: MacOS
17:05:05.083 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
17:05:05.084 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 11
17:05:05.088 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
17:05:05.089 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
17:05:05.090 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
17:05:05.093 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
    at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
    at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:224)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
    at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:218)
    at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:213)
    at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:81)
    at io.netty.util.AsciiString.<init>(AsciiString.java:222)
    at io.netty.util.AsciiString.<init>(AsciiString.java:209)
    at io.netty.util.AsciiString.cached(AsciiString.java:1401)
    at io.netty.util.AsciiString.<clinit>(AsciiString.java:47)
    at io.grpc.netty.Utils.<clinit>(Utils.java:80)
    at io.grpc.netty.UdsNettyChannelProvider.isAvailable(UdsNettyChannelProvider.java:35)
    at io.grpc.ManagedChannelRegistry$ManagedChannelPriorityAccessor.isAvailable(ManagedChannelRegistry.java:211)
    at io.grpc.ManagedChannelRegistry$ManagedChannelPriorityAccessor.isAvailable(ManagedChannelRegistry.java:207)
    at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:68)
    at io.grpc.ManagedChannelRegistry.getDefaultRegistry(ManagedChannelRegistry.java:101)
    at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:43)
    at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:44)
    at io.milvus.client.MilvusServiceClient.<init>(MilvusServiceClient.java:133)
    at com.example.sbm.milvus.SimpleExample.<clinit>(SimpleExample.java:40)
17:05:05.094 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
17:05:05.096 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @b9341ca0
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
    at java.base/java.lang.reflect.Method.invoke(Method.java:558)
    at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:334)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
    at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:325)
    at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:213)
    at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:81)
    at io.netty.util.AsciiString.<init>(AsciiString.java:222)
    at io.netty.util.AsciiString.<init>(AsciiString.java:209)
    at io.netty.util.AsciiString.cached(AsciiString.java:1401)
    at io.netty.util.AsciiString.<clinit>(AsciiString.java:47)
    at io.grpc.netty.Utils.<clinit>(Utils.java:80)
    at io.grpc.netty.UdsNettyChannelProvider.isAvailable(UdsNettyChannelProvider.java:35)
    at io.grpc.ManagedChannelRegistry$ManagedChannelPriorityAccessor.isAvailable(ManagedChannelRegistry.java:211)
    at io.grpc.ManagedChannelRegistry$ManagedChannelPriorityAccessor.isAvailable(ManagedChannelRegistry.java:207)
    at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:68)
    at io.grpc.ManagedChannelRegistry.getDefaultRegistry(ManagedChannelRegistry.java:101)
    at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:43)
    at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:44)
    at io.milvus.client.MilvusServiceClient.<init>(MilvusServiceClient.java:133)
    at com.example.sbm.milvus.SimpleExample.<clinit>(SimpleExample.java:40)
17:05:05.098 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
17:05:05.098 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
17:05:05.129 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 4294967296 bytes (maybe)
17:05:05.129 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/l2/_n_fkz890_g4fk0rxnhlw0qc0000gn/T (java.io.tmpdir)
17:05:05.129 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
17:05:05.132 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
17:05:05.132 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
17:05:05.133 [main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
17:05:05.133 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
17:05:05.230 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 20
17:05:05.253 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
17:05:05.254 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
17:05:05.262 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
17:05:05.346 [main] INFO io.milvus.client.AbstractMilvusGrpcClient - HasCollectionParam(collectionName=car, databaseName=null)
17:05:05.459 [grpc-default-executor-0] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
17:05:05.459 [grpc-default-executor-0] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
Mar 03, 2024 5:05:05 PM io.grpc.internal.ManagedChannelImpl$2 uncaughtException
SEVERE: [Channel<1>: (127.0.0.1:19530)] Uncaught exception in the SynchronizationContext. Panic!
java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater
    at io.netty.buffer.Unpooled.wrappedBuffer(Unpooled.java:160)
    at io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74)
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:221)
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34)
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34)
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259)
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66)
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201)
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94)
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126)
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1886)
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98)
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:839)
Caused by: java.lang.ClassNotFoundException: io.netty.util.internal.ReferenceCountUpdater
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:766)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1074)
    ... 16 more

17:05:05.506 [main] ERROR io.milvus.client.AbstractMilvusGrpcClient - HasCollectionRequest RPC failed:car
io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
    at io.grpc.StatusRuntimeException.fillInStackTrace(StatusRuntimeException.java:68)
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:58)
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:50)
    at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
    at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
    at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
    at io.milvus.grpc.MilvusServiceGrpc$MilvusServiceBlockingStub.hasCollection(MilvusServiceGrpc.java:4453)
    at io.milvus.client.AbstractMilvusGrpcClient.hasCollection(AbstractMilvusGrpcClient.java:353)
    at io.milvus.client.MilvusServiceClient.lambda$hasCollection$1(MilvusServiceClient.java:305)
    at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:256)
    at io.milvus.client.MilvusServiceClient.hasCollection(MilvusServiceClient.java:305)
    at com.example.sbm.milvus.SimpleExample.main(SimpleExample.java:44)
Caused by: java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater
    at io.netty.buffer.Unpooled.wrappedBuffer(Unpooled.java:160)
    at io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74)
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:221)
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34)
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34)
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259)
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66)
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201)
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94)
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126)
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1886)
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98)
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:839)
Caused by: java.lang.ClassNotFoundException: io.netty.util.internal.ReferenceCountUpdater
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:766)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1074)
    ... 16 common frames omitted
milvus status is : -3

Process finished with exit code 0
ztg25 commented 6 months ago

我的Milvus在本机以容器方式启动,使用本机springboot启动连接,出现这个错误。但我使用官网python测试代码就可以正常连接并创建Collection。请问Java SDK version2.3.3 这个版本是否无法连接到milvusdb/milvus:latest这个版本。因为我本地生成milvusdb/milvus:v2.3.3出错,所以只能使用milvusdb/milvus:latest这个版本。

yhmo commented 6 months ago

不是连接的问题,应该是有dependency conflict,跟server端没有关系。你的pom文件里如果只有那么点东西,应该是能跑的,我这边跑相同的pom相同的代码没问题。

yhmo commented 6 months ago

如果你能用attu连上的话,就能看到milvus server的版本号 Screenshot from 2024-03-04 17-17-41

xiaofan-luan commented 6 months ago

我的Milvus在本机以容器方式启动,使用本机springboot启动连接,出现这个错误。但我使用官网python测试代码就可以正常连接并创建Collection。请问Java SDK version2.3.3 这个版本是否无法连接到milvusdb/milvus:latest这个版本。因为我本地生成milvusdb/milvus:v2.3.3出错,所以只能使用milvusdb/milvus:latest这个版本。

this is because your jvm settings.

java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled Basically this means your jvm didn't support to reflect private object but netty need to do so.

This could happen if you are using JPMS or you are running security manager

ztg25 commented 6 months ago

开发环境-JDK11, intelljIDEA,maven3.6.1, macOS, 代码链接:https://github.com/ztg25/milvus-demo 按着提供的思路发现,查询资料发现,JDK8以上好像都不支持setAccessible(true),所以netty使用时会报这样的错误。netty在以后的版本里也做了相应的处理。 pom内容:

<properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.milvus</groupId>
            <artifactId>milvus-sdk-java</artifactId>
            <version>2.3.3</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-buffer</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.netty/netty-buffer -->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-buffer</artifactId>
            <version>4.1.107.Final</version>
        </dependency>

        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty</artifactId>
            <version>1.61.0</version>
        </dependency>

    </dependencies>

于是我试着使用最新的netty来处理,目前发现这个错误是消失了。但也有了新的问题。

2024-03-05 14:33:40.501  INFO 33753 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-03-05 14:33:40.503  INFO 33753 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-03-05 14:33:40.527  INFO 33753 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 24 ms
2024-03-05 14:33:40.570  INFO 33753 --- [nio-8080-exec-1] i.m.client.AbstractMilvusGrpcClient      : HasCollectionParam(collectionName=hello_milvus, databaseName=null)
2024-03-05 14:33:40.685 ERROR 33753 --- [ault-executor-0] io.grpc.internal.ManagedChannelImpl      : [Channel<1>: (localhost:19530)] Uncaught exception in the SynchronizationContext. Panic!

java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater
    at io.netty.buffer.Unpooled.wrappedBuffer(Unpooled.java:160) ~[netty-buffer-4.1.107.Final.jar:4.1.107.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74) ~[netty-codec-http2-4.1.34.Final.jar:4.1.34.Final]
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:221) ~[grpc-netty-1.61.0.jar:1.61.0]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1886) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333) ~[grpc-core-1.61.0.jar:1.61.0]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:839) ~[na:na]
Caused by: java.lang.ClassNotFoundException: io.netty.util.internal.ReferenceCountUpdater
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:766) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1074) ~[na:na]
    ... 16 common frames omitted

2024-03-05 14:33:40.694 ERROR 33753 --- [nio-8080-exec-1] i.m.client.AbstractMilvusGrpcClient      : HasCollectionRequest RPC failed:hello_milvus

io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
    at io.grpc.StatusRuntimeException.fillInStackTrace(StatusRuntimeException.java:68) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:58) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:50) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271) ~[grpc-stub-1.46.0.jar:1.46.0]
    at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252) ~[grpc-stub-1.46.0.jar:1.46.0]
    at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165) ~[grpc-stub-1.46.0.jar:1.46.0]
    at io.milvus.grpc.MilvusServiceGrpc$MilvusServiceBlockingStub.hasCollection(MilvusServiceGrpc.java:4453) ~[milvus-sdk-java-2.3.3.jar:na]
    at io.milvus.client.AbstractMilvusGrpcClient.hasCollection(AbstractMilvusGrpcClient.java:353) ~[milvus-sdk-java-2.3.3.jar:na]
    at io.milvus.client.MilvusServiceClient.lambda$hasCollection$1(MilvusServiceClient.java:305) ~[milvus-sdk-java-2.3.3.jar:na]
    at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:256) ~[milvus-sdk-java-2.3.3.jar:na]
    at io.milvus.client.MilvusServiceClient.hasCollection(MilvusServiceClient.java:305) ~[milvus-sdk-java-2.3.3.jar:na]
    at com.example.demo.controller.MilvusController.checkMilvusService(MilvusController.java:21) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.base/java.lang.Thread.run(Thread.java:839) ~[na:na]
Caused by: java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater
    at io.netty.buffer.Unpooled.wrappedBuffer(Unpooled.java:160) ~[netty-buffer-4.1.107.Final.jar:4.1.107.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74) ~[netty-codec-http2-4.1.34.Final.jar:4.1.34.Final]
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:221) ~[grpc-netty-1.61.0.jar:1.61.0]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126) ~[grpc-api-1.61.0.jar:1.61.0]
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1886) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98) ~[grpc-core-1.61.0.jar:1.61.0]
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333) ~[grpc-core-1.61.0.jar:1.61.0]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    ... 1 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.netty.util.internal.ReferenceCountUpdater
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:766) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1074) ~[na:na]
    ... 16 common frames omitted

milvus status is : -3
response : INTERNAL: Panic! This is a bug!
xiaofan-luan commented 6 months ago

you could try latest 2.3.4. where the grpc has been upgrade to 1.59.1 https://github.com/milvus-io/milvus-sdk-java/releases/tag/v2.3.4

ztg25 commented 6 months ago

The same error log on milvus-sdk-java 2.3.4. Does it just suit for JDK1.8 and below?
Hi @yhmo Does your code run well on JDK11?

xiaofan-luan commented 6 months ago

I believe 1.59.1 is already a very late grpc version. did you still get "java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled"?

ztg25 commented 6 months ago

No, it still shows me this 'java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater" error when updated to milvus-sdk-java 2.3.4.

xiaofan-luan commented 6 months ago

remove all the mvn changes you made. most likely this is a dependency issue With new milvus java sdk you shouldn't need to change the dependency

ztg25 commented 6 months ago

I tried to import milvus-sdk-java 2.3.4 only, but there are errors as below.

2024-03-06 13:59:57.996  INFO 50482 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-03-06 13:59:57.997  INFO 50482 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-03-06 13:59:58.018  INFO 50482 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed initialization in 20 ms
2024-03-06 13:59:58.218 ERROR 50482 --- [ault-executor-0] io.grpc.internal.ManagedChannelImpl      : [Channel<1>: (localhost:19530)] Uncaught exception in the SynchronizationContext. Panic!

java.lang.NoSuchMethodError: io/netty/buffer/PooledByteBufAllocator.<init>(ZIIIIIIZ)V (loaded from file:/Users/tony/.m2/repository/io/netty/netty-buffer/4.1.34.Final/netty-buffer-4.1.34.Final.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@be7d8ce7) called from class io.grpc.netty.Utils (loaded from file:/Users/tony/.m2/repository/io/grpc/grpc-netty/1.59.1/grpc-netty-1.59.1.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@be7d8ce7).
    at io.grpc.netty.Utils.createByteBufAllocator(Utils.java:187) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.netty.Utils.access$000(Utils.java:77) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder.<clinit>(Utils.java:100) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.netty.Utils.getByteBufAllocator(Utils.java:155) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:238) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1868) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333) ~[grpc-core-1.59.1.jar:1.59.1]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:839) ~[na:na]

2024-03-06 13:59:58.227 ERROR 50482 --- [nio-8080-exec-2] i.m.client.AbstractMilvusGrpcClient      : HasCollectionRequest collectionName:hello_milvus RPC failed! Exception:{}

io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
    at io.grpc.StatusRuntimeException.fillInStackTrace(StatusRuntimeException.java:68) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:58) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:50) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268) ~[grpc-stub-1.59.1.jar:1.59.1]
    at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249) ~[grpc-stub-1.59.1.jar:1.59.1]
    at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167) ~[grpc-stub-1.59.1.jar:1.59.1]
    at io.milvus.grpc.MilvusServiceGrpc$MilvusServiceBlockingStub.hasCollection(MilvusServiceGrpc.java:3992) ~[milvus-sdk-java-2.3.4.jar:na]
    at io.milvus.client.AbstractMilvusGrpcClient.hasCollection(AbstractMilvusGrpcClient.java:372) ~[milvus-sdk-java-2.3.4.jar:na]
    at io.milvus.client.MilvusServiceClient.lambda$hasCollection$1(MilvusServiceClient.java:362) ~[milvus-sdk-java-2.3.4.jar:na]
    at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:285) ~[milvus-sdk-java-2.3.4.jar:na]
    at io.milvus.client.MilvusServiceClient.hasCollection(MilvusServiceClient.java:362) ~[milvus-sdk-java-2.3.4.jar:na]
    at com.example.demo.controller.MilvusController.checkMilvusService(MilvusController.java:21) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
    at java.base/java.lang.Thread.run(Thread.java:839) ~[na:na]
ztg25 commented 6 months ago

springboot's pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>milvus-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>springboot-demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.milvus</groupId>
            <artifactId>milvus-sdk-java</artifactId>
            <version>2.3.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
xiaofan-luan commented 6 months ago

java.lang.NoSuchMethodError: io/netty/buffer/PooledByteBufAllocator.(ZIIIIIIZ)V (loaded from file:/Users/tony/.m2/repository/io/netty/netty-buffer/4.1.34.Final/netty-buffer-4.1.34.Final.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@be7d8ce7) called from class io.grpc.netty.Utils (loaded from file:/Users/tony/.m2/repository/io/grpc/grpc-netty/1.59.1/grpc-netty-1.59.1.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@be7d8ce7).

try to check mvn dependency and see where this is 4.1.34 is depend on.

1.59.1 relies on 4.1.97 so you get dependency conflicts

maybe try

io.netty netty-buffer io.grpc grpc-netty

and see if it can use netty 4.1.34

ztg25 commented 6 months ago
[INFO] \- io.milvus:milvus-sdk-java:jar:2.3.4:compile
[INFO]    +- io.grpc:grpc-netty:jar:1.59.1:compile
[INFO]    |  +- io.grpc:grpc-core:jar:1.59.1:compile
[INFO]    |  |  +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO]    |  |  +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.23:runtime
[INFO]    |  |  +- io.grpc:grpc-context:jar:1.59.1:runtime
[INFO]    |  |  \- io.grpc:grpc-util:jar:1.59.1:runtime
[INFO]    |  +- io.netty:netty-codec-http2:jar:4.1.34.Final:compile
[INFO]    |  |  +- io.netty:netty-common:jar:4.1.34.Final:compile
[INFO]    |  |  +- io.netty:netty-buffer:jar:4.1.34.Final:compile
[INFO]    |  |  +- io.netty:netty-transport:jar:4.1.34.Final:compile
[INFO]    |  |  |  \- io.netty:netty-resolver:jar:4.1.34.Final:compile
[INFO]    |  |  +- io.netty:netty-codec:jar:4.1.34.Final:compile
[INFO]    |  |  +- io.netty:netty-handler:jar:4.1.34.Final:compile
[INFO]    |  |  \- io.netty:netty-codec-http:jar:4.1.34.Final:compile
[INFO]    |  +- io.netty:netty-handler-proxy:jar:4.1.34.Final:runtime
[INFO]    |  |  \- io.netty:netty-codec-socks:jar:4.1.34.Final:runtime
[INFO]    |  +- com.google.guava:guava:jar:32.0.1-android:compile
[INFO]    |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO]    |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO]    |  |  +- org.checkerframework:checker-qual:jar:3.33.0:compile
[INFO]    |  |  \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
[INFO]    |  +- com.google.errorprone:error_prone_annotations:jar:2.20.0:compile
[INFO]    |  +- io.perfmark:perfmark-api:jar:0.26.0:runtime
[INFO]    |  \- io.netty:netty-transport-native-unix-common:jar:4.1.34.Final:runtime
[INFO]    +- io.grpc:grpc-protobuf:jar:1.59.1:compile
[INFO]    |  +- io.grpc:grpc-api:jar:1.59.1:compile
[INFO]    |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO]    |  +- com.google.api.grpc:proto-google-common-protos:jar:2.22.0:compile
[INFO]    |  \- io.grpc:grpc-protobuf-lite:jar:1.59.1:compile
[INFO]    +- io.grpc:grpc-stub:jar:1.59.1:compile
[INFO]    +- com.google.protobuf:protobuf-java:jar:3.24.0:compile
[INFO]    +- org.apache.commons:commons-text:jar:1.10.0:compile
[INFO]    |  \- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO]    +- org.apache.commons:commons-collections4:jar:4.3:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO]    +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.2:compile
[INFO]    |  +- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO]    |  \- org.apache.logging.log4j:log4j-core:jar:2.11.2:runtime
[INFO]    +- com.squareup.okhttp3:okhttp:jar:4.10.0:compile
[INFO]    |  \- com.squareup.okio:okio-jvm:jar:3.0.0:compile
[INFO]    |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.2.71:compile
[INFO]    |        \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.2.71:compile
[INFO]    +- org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[INFO]    +- com.google.code.gson:gson:jar:2.8.5:compile
[INFO]    +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.2.71:compile
[INFO]    |  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.2.71:compile
[INFO]    |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO]    \- com.alibaba:fastjson:jar:1.2.83:compile
ztg25 commented 6 months ago

your mean that use netty-buffer 4.1.97 replace 4.1.34? @xiaofan-luan

java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater
    at io.netty.buffer.Unpooled.wrappedBuffer(Unpooled.java:160) ~[netty-buffer-4.1.97.Final.jar:4.1.97.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74) ~[netty-codec-http2-4.1.34.Final.jar:4.1.34.Final]
    at io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:221) ~[grpc-netty-1.59.1.jar:1.59.1]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:34) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:259) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:66) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:201) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126) ~[grpc-api-1.59.1.jar:1.59.1]
    at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1868) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98) ~[grpc-core-1.59.1.jar:1.59.1]
    at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333) ~[grpc-core-1.59.1.jar:1.59.1]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:839) ~[na:na]
Caused by: java.lang.ClassNotFoundException: io.netty.util.internal.ReferenceCountUpdater
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:766) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1074) ~[na:na]
    ... 16 common frames omitted

dependency:tree as below.

[INFO] +- io.milvus:milvus-sdk-java:jar:2.3.4:compile
[INFO] |  +- io.grpc:grpc-netty:jar:1.59.1:compile
[INFO] |  |  +- io.grpc:grpc-core:jar:1.59.1:compile
[INFO] |  |  |  +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO] |  |  |  +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.23:runtime
[INFO] |  |  |  +- io.grpc:grpc-context:jar:1.59.1:runtime
[INFO] |  |  |  \- io.grpc:grpc-util:jar:1.59.1:runtime
[INFO] |  |  +- io.netty:netty-codec-http2:jar:4.1.34.Final:compile
[INFO] |  |  |  +- io.netty:netty-transport:jar:4.1.34.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-resolver:jar:4.1.34.Final:compile
[INFO] |  |  |  +- io.netty:netty-codec:jar:4.1.34.Final:compile
[INFO] |  |  |  +- io.netty:netty-handler:jar:4.1.34.Final:compile
[INFO] |  |  |  \- io.netty:netty-codec-http:jar:4.1.34.Final:compile
[INFO] |  |  +- io.netty:netty-handler-proxy:jar:4.1.34.Final:runtime
[INFO] |  |  |  \- io.netty:netty-codec-socks:jar:4.1.34.Final:runtime
[INFO] |  |  +- com.google.guava:guava:jar:32.0.1-android:compile
[INFO] |  |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  |  +- org.checkerframework:checker-qual:jar:3.33.0:compile
[INFO] |  |  |  \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.20.0:compile
[INFO] |  |  +- io.perfmark:perfmark-api:jar:0.26.0:runtime
[INFO] |  |  \- io.netty:netty-transport-native-unix-common:jar:4.1.34.Final:runtime
[INFO] |  +- io.grpc:grpc-protobuf:jar:1.59.1:compile
[INFO] |  |  +- io.grpc:grpc-api:jar:1.59.1:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  +- com.google.api.grpc:proto-google-common-protos:jar:2.22.0:compile
[INFO] |  |  \- io.grpc:grpc-protobuf-lite:jar:1.59.1:compile
[INFO] |  +- io.grpc:grpc-stub:jar:1.59.1:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.24.0:compile
[INFO] |  +- org.apache.commons:commons-text:jar:1.10.0:compile
[INFO] |  |  \- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] |  +- org.apache.commons:commons-collections4:jar:4.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO] |  +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.2:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO] |  |  \- org.apache.logging.log4j:log4j-core:jar:2.11.2:runtime
[INFO] |  +- com.squareup.okhttp3:okhttp:jar:4.10.0:compile
[INFO] |  |  \- com.squareup.okio:okio-jvm:jar:3.0.0:compile
[INFO] |  |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.2.71:compile
[INFO] |  |        \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.2.71:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] |  +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.2.71:compile
[INFO] |  |  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.2.71:compile
[INFO] |  |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  \- com.alibaba:fastjson:jar:1.2.83:compile
[INFO] \- io.netty:netty-buffer:jar:4.1.97.Final:compile
[INFO]    \- io.netty:netty-common:jar:4.1.34.Final:compile
xiaofan-luan commented 6 months ago

dependency looks good. no idea about what is going on about your environment. Maybe try mvn clean see to clean all dependencies and see if it helps

ztg25 commented 6 months ago

Thanks a lot your support. I did the "mvn clean" of command after every pom.xml file change. I'm not sure whether this error is relate to JDK11.

xiaofan-luan commented 6 months ago

This is what I got from chatgpt and hopefully it will help

The error you're encountering, java.lang.NoClassDefFoundError: io.netty.util.internal.ReferenceCountUpdater, followed by a java.lang.ClassNotFoundException, suggests that the Java runtime environment cannot find the ReferenceCountUpdater class from the Netty library. This issue often occurs due to classpath problems where the required library (or the correct version of it) is not found during runtime. Here's how you can address it:

Ensure Netty Library is Included: Make sure that the Netty library, which contains the io.netty.util.internal.ReferenceCountUpdater class, is included in your project dependencies. If you're using a build tool like Maven or Gradle, ensure that you have the correct Netty dependency specified in your pom.xml or build.gradle file, respectively.

Check for Version Compatibility: The error stack trace indicates multiple Netty components (netty-buffer, netty-codec-http2, and others) along with grpc-netty are being used. It's crucial to ensure that all these components are compatible with each other. Version mismatches between these libraries can lead to NoClassDefFoundError or ClassNotFoundException. Verify that you're using versions of these libraries that are known to work well together.

Update Dependencies: If you're using an older version of the Netty library, consider updating to a more recent version that might have fixed the issue you're experiencing. However, ensure that the update is compatible with other libraries you're using.

Review Classpath Configuration: The error might be due to the runtime environment not being able to access the Netty library, even if it's correctly included in your project dependencies. Ensure that the classpath is correctly set up, especially if you're running your application from the command line or a custom environment. If you're using an IDE, make sure the dependency is correctly configured and recognized by the IDE.

Clean and Rebuild: Sometimes, stale artifacts in the build directory can cause unexpected issues. Clean your project's build directory and rebuild the project. For Maven, you can use mvn clean install, and for Gradle, gradle clean build.

Examine Dependency Conflicts: If your project includes other libraries that also depend on Netty, there could be conflicting versions. Use your build tool's dependency tree analysis feature to examine and resolve any conflicts. For Maven, mvn dependency:tree can help identify conflicts, and for Gradle, you can use gradle dependencies.

Implementing these steps should help resolve the NoClassDefFoundError and ClassNotFoundException related to the Netty library. If the problem persists, consider looking into more detailed logs or debugging information to identify the root cause more precisely.

yhmo commented 6 months ago

这个版本太低了,我使用跟你一模一样的pom文件,只是把这个版本改成3.2.0就没问题 据我测下来,3.0版本以上都没问题,3.0以下都有问题。

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
ztg25 commented 6 months ago

是的,我也验证了,springboot3.0以下的包与milvus-sdk-java是有冲突的。我升级后没有问题,谢谢 @yhmo @xiaofan-luan

ztg25 commented 6 months ago

问题解决,关闭问题。

csrecord commented 3 months ago