Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer; #877

Open
onestow opened this issue Apr 23, 2024 · 9 comments

Comments

@onestow
Copy link

onestow commented Apr 23, 2024

My JDK version is 1.8, milvus-sdk-java version is 2.4.0, when I run SearchResultsWrapper.getIDScore, and I got the exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
	at io.milvus.response.FieldDataWrapper.getFieldData(FieldDataWrapper.java:248)
	at io.milvus.response.FieldDataWrapper.valueByIdx(FieldDataWrapper.java:351)
	at io.milvus.response.SearchResultsWrapper.getIDScore(SearchResultsWrapper.java:207)
	at com.tom.MilvusTest.myTest(MilvusTest.java:190)
	at com.tom.MilvusTest.main(MilvusTest.java:114)

how to solve it?

@onestow
Copy link
Author

onestow commented Apr 24, 2024

jdk21 is normal
jdk8 is not support?

@xiaofan-luan
Copy link
Contributor

@xiaofan-luan
Copy link
Contributor

this is a java compilation bug need to be fixed.

@onestow would you mind fix that?

@onestow
Copy link
Author

onestow commented Apr 25, 2024

I'm sorry, but I haven't had time for anything else recently v_v

@xiaofan-luan
Copy link
Contributor

/assign @yhmo could you help on it?

@yhmo
Copy link
Contributor

yhmo commented Apr 25, 2024

Java SDK is compiled by openjdk 11 with language level 8. Seems this is an issue of ByteBuffer. If it cannot run under jdk 1.8, try use jdk 11 instead.
I need to install 1.8 to test the issue first, I am not sure is any quick solution there.

@xiaofan-luan
Copy link
Contributor

check the link

...

<maven.compiler.release>8</maven.compiler.release>

...

@yhmo
Copy link
Contributor

yhmo commented Apr 26, 2024

maven.compiler.release doesn't resolve this issue.

I tested on my local.

  • compile sdk with openjdk 1.8 and language level 8
    run client with openjdk 1.8 and language level 8, the ByteBuffer works fine
    run client with openjdk 11 and language level 8, the ByteBuffer works fine

  • compile sdk with openjdk 11 and language level 8
    run client with openjdk 1.8 and language level 8, get NoSuchMethod error of ByteBuffer such as rewind()/position()
    run client with openjdk 11 and language level 8, the ByteBuffer works fine

@yhmo
Copy link
Contributor

yhmo commented Apr 26, 2024

A possible solution is: compile the SDK with OpenJDK 1.8 and language level 8 from the next version.

There is a potential problem: seems the tensorflow-core-platform could not work under openjdk 1.8. (Currently, we use this lib for Float16Vector examples).

java: cannot access org.tensorflow.ndarray.buffer.ByteDataBuffer
  bad class file: /home/yhmo/.m2/repository/org/tensorflow/ndarray/0.4.0/ndarray-0.4.0.jar!/org/tensorflow/ndarray/buffer/ByteDataBuffer.class
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants