You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (Jira)" <ji...@apache.org> on 2020/07/01 20:14:00 UTC

[jira] [Closed] (FLINK-18455) Building with JDK 9+ leads to problems on JDK 8

     [ https://issues.apache.org/jira/browse/FLINK-18455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chesnay Schepler closed FLINK-18455.
------------------------------------
    Fix Version/s: 1.12.0
       Resolution: Fixed

master: ba92b3b8b02e099c8aab4b2b23a37dca4558cabd

> Building with JDK 9+ leads to problems on JDK 8
> -----------------------------------------------
>
>                 Key: FLINK-18455
>                 URL: https://issues.apache.org/jira/browse/FLINK-18455
>             Project: Flink
>          Issue Type: Bug
>          Components: Build System
>    Affects Versions: 1.10.1
>            Reporter: Niels Basjes
>            Assignee: Niels Basjes
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.0
>
>
> I was working on some changes in Flink and on my workstation I have also JDK 14 installed.
> When Flink is built using JDK > 8 and then run using JDK 8 the problem surfaces that the code crashes with the exception like this:
> {code:java}
> java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
> 	at org.apache.flink.core.memory.DataOutputSerializer.wrapAsByteBuffer(DataOutputSerializer.java:65) ~[classes/:?]
> 	at org.apache.flink.runtime.io.network.api.serialization.SpanningRecordSerializer.<init>(SpanningRecordSerializer.java:50) ~[classes/:?]
> 	at org.apache.flink.runtime.io.network.api.writer.RecordWriter.<init>(RecordWriter.java:98) ~[classes/:?]
> 	at org.apache.flink.runtime.io.network.api.writer.ChannelSelectorRecordWriter.<init>(ChannelSelectorRecordWriter.java:50) ~[classes/:?]
> 	at org.apache.flink.runtime.io.network.api.writer.RecordWriterBuilder.build(RecordWriterBuilder.java:53) ~[classes/:?]
> {code}
> This is a problem in the way JDK 9+ generates the code that is incompatible with using the JDK 8 runtime, even if during the build it was indicated that JRE 8 would be the target.
> I have found several projects have ran into the exact same problem:
>  - https://issues.apache.org/jira/browse/MRESOLVER-67
>  - [https://github.com/eclipse/jetty.project/issues/3244]
>  - [https://github.com/netty/netty/issues/9880]
>  - [https://github.com/apache/felix/pull/114]
>  - [https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip] 
> -As indicated in the mentioned Jetty ticket the solution is quite simple:-
> {quote}-The solution is to cast the {{ByteBuffer}} to {{Buffer}} when calling those methods:-
> {code:java}
> ((Buffer)byteBuffer).position(0);{code}
>  -- 
> {quote}
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)