You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2024/07/04 11:43:18 UTC
[PR] HDDS-11076. NoSuchMethodError: ByteBuffer.position compiling with Java 9+, running with Java 8 [ozone]
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11076. NoSuchMethodError: ByteBuffer.position compiling with Java 9+, running with Java 8 [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #6897:
URL: https://github.com/apache/ozone/pull/6897
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11076. NoSuchMethodError: ByteBuffer.position compiling with Java 9+, running with Java 8 [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6897:
URL: https://github.com/apache/ozone/pull/6897#issuecomment-2213127464
Thanks @szetszwo for the review.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org