-
Notifications
You must be signed in to change notification settings - Fork 199
NoSuchMethodError when querying sparse vectors on Java 8 #1779
Copy link
Copy link
Open
Description
Environment
- Runtime: Java 8 (observed from stack trace:
java.lang.Thread.run(Thread.java:750)) - Milvus Java SDK:
io.milvus:milvus-sdk-java:2.6.15(also reproducible with 2.6.14 depending on the classpath, see below) - API: Query (v2 client), requesting a sparse vector field in
OutputFields
Problem
When performing a Query that returns sparse vector fields, the application crashes with a NoSuchMethodError:
java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
at io.milvus.param.ParamUtils.decodeSparseFloatVector(ParamUtils.java:1332)
at io.milvus.response.FieldDataWrapper.getVectorData(FieldDataWrapper.java:326)
at io.milvus.response.FieldDataWrapper.getFieldDataInternal(FieldDataWrapper.java:244)
at io.milvus.response.FieldDataWrapper.getFieldData(FieldDataWrapper.java:231)
at io.milvus.response.FieldDataWrapper.valueByIdx(FieldDataWrapper.java:506)
at io.milvus.response.basic.RowRecordWrapper.buildRowRecord(RowRecordWrapper.java:82)
at io.milvus.response.QueryResultsWrapper.buildRowRecord(QueryResultsWrapper.java:94)
at io.milvus.response.QueryResultsWrapper.getRowRecords(QueryResultsWrapper.java:78)
at io.milvus.v2.utils.ConvertUtils.getEntities(ConvertUtils.java:86)
at io.milvus.v2.service.vector.VectorService.query(VectorService.java:248)
...
How to reproduce
- Run an application on Java 8 that uses
milvus-sdk-java2.6.15. - Query a collection and include a sparse vector field in
OutputFields(or otherwise trigger decoding of sparse vectors). - The query fails with
NoSuchMethodErrorshown above.
Expected behavior
Query should succeed and return entities (including sparse vectors) on Java 8.
Observed behavior
Query fails at runtime with NoSuchMethodError in ParamUtils.decodeSparseFloatVector while decoding sparse vectors.
Suspected root cause
This looks like a Java 8 compatibility issue caused by an incompatible method descriptor used by the SDK at runtime:
- On Java 8,
java.nio.ByteBuffer.rewind()returnsjava.nio.Buffer(i.e., the method isrewind()Ljava/nio/Buffer;). - The runtime error indicates the SDK is trying to call
ByteBuffer.rewind()with the descriptor()Ljava/nio/ByteBuffer;, which corresponds to the covariant return type introduced in later JDKs (Java 9+). - Therefore, when running on Java 8, the JVM cannot resolve
ByteBuffer.rewind(): ByteBuffer, causingNoSuchMethodError.
Workarounds
- Build milvus-sdk-java-2.6.x.jar using Java 8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels