adoroszlai opened a new pull request, #6897:
URL: https://github.com/apache/ozone/pull/6897
## What changes were proposed in this pull request?
Building Ozone with Java 9+ (but still targeting Java 8 with
`javac.version=8`) and running with Java 8 results in:
```
NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at
org.apache.hadoop.ozone.common.ChunkBufferImplWithByteBuffer.duplicate(ChunkBufferImplWithByteBuffer.java:111)
```
It can be reproduced in Hadoop compatibility tests, because Hadoop images
still ship with Java 8, while Ozone images have newer Java.
CI tweak for repro:
https://github.com/adoroszlai/ozone/commit/33f7f4b2cc26e380ee7e570b990ef9962021b89c
Failure:
https://github.com/adoroszlai/ozone/actions/runs/9792172547/job/27038142506#step:6:9
Exception can be seen in `log.html` in the [test
artifact](https://github.com/adoroszlai/ozone/actions/runs/9792172547/artifacts/1667509237).
Blog with great explanation of the problem and solution:
https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/
It can be fixed by setting `--release` for `javac`, via
`maven.compiler.release`. This is a new option for JDK 9+, so it must be done
conditionally, in a profile.
https://issues.apache.org/jira/browse/HDDS-11076
## How was this patch tested?
Using the same CI repro with the fix:
https://github.com/adoroszlai/ozone/actions/runs/9792162687
Regular CI (for testing build with Java 8):
https://github.com/adoroszlai/ozone/actions/runs/9792724664
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]