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

Fix to avoid incompatibility if compile with jdk9 #6584

Closed
snnn opened this issue Feb 5, 2021 · 6 comments · Fixed by #6589
Closed

Fix to avoid incompatibility if compile with jdk9 #6584

snnn opened this issue Feb 5, 2021 · 6 comments · Fixed by #6589
Labels
api:Java issues related to the Java API

Comments

@snnn
Copy link
Member

snnn commented Feb 5, 2021

Describe the bug
See apache/felix#114

Urgency
If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: master
  • Python version: N/A
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

To Reproduce

  • Describe steps/code to reproduce the behavior.

Build onnxruntime with java enabled, and run the tests.


    => java.lang.NoSuchMethodError: java.nio.FloatBuffer.rewind()Ljava/nio/FloatBuffer;
       ai.onnxruntime.InferenceTest.testModelInputBuffer(InferenceTest.java:935)
       sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       java.lang.reflect.Method.invoke(Method.java:498)
       org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
       org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
       org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
       org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
       org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
       [...]
  JUnit Jupiter:InferenceTest:testModelInputFLOAT()
    MethodSource [className = 'ai.onnxruntime.InferenceTest', methodName = 'testModelInputFLOAT', methodParameterTypes = '']
    => java.lang.NoSuchMethodError: java.nio.FloatBuffer.rewind()Ljava/nio/FloatBuffer;
       ai.onnxruntime.OnnxTensor.getFloatBuffer(OnnxTensor.java:167)
       ai.onnxruntime.InferenceTest.testModelInputFLOAT(InferenceTest.java:906)
       sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       java.lang.reflect.Method.invoke(Method.java:498)
       org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
       org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
       org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
       org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)

@snnn snnn added the api:Java issues related to the Java API label Feb 5, 2021
@snnn
Copy link
Member Author

snnn commented Feb 5, 2021

@Craigacp could you please help?

@Craigacp
Copy link
Contributor

Craigacp commented Feb 5, 2021

Sure, that's easy to fix in the build system. How did you manage to skew JAVA_HOME between the build and test if it was in the same command?

@snnn
Copy link
Member Author

snnn commented Feb 5, 2021

They are on two different machines. We build the jar on Windows then run the tests on Win/Linux/Mac. So very likely the java version mismatches.

@Craigacp
Copy link
Contributor

Craigacp commented Feb 5, 2021

Ok. Basically we need to conditionally set the -release 8 flag when compiling on 9 or newer. It doesn't exist in 8 so it can't be on permanently. I'm just figuring out the gradle syntax.

@snnn
Copy link
Member Author

snnn commented Feb 5, 2021

Do we need to continue to support JDK8?

@Craigacp
Copy link
Contributor

Craigacp commented Feb 5, 2021

Personally I would like it to for at least another release, as Tribuo hasn't moved to Java 11 yet, and Tribuo is why I wrote the Java bindings. I'm not sure if our internal users have moved on from Java 8 yet, I'll check.

Changing the minimum Java version is probably worth a separate issue and some discussion from the interested parties in Oracle, MS & AWS. I dunno what version of Java DJL uses. Apache Spark only just released support for Java 11 in version 3.0 which came out in the middle of last year.

The patch in gradle to make it work when compiling on 9+ but running on 8 is small, I'll work up a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:Java issues related to the Java API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants