You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Martijn Visser (Jira)" <ji...@apache.org> on 2024/03/13 07:55:00 UTC

[jira] [Commented] (FLINK-34658) Scala API unusable on Flink 1.18.1/Java 17 Docker image

    [ https://issues.apache.org/jira/browse/FLINK-34658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825951#comment-17825951 ] 

Martijn Visser commented on FLINK-34658:
----------------------------------------

[~mbernst] I think that's a known issue that we can't do too much about. Java 17 requieres a newer Scala compiler, but we can't use a newer version of Scala 2.12 beyond 2.12.8 because Scala introduces a binary incompatibility in 2.12.8. That breaks all savepoint compatibility for Scala users. That was reported and documented in FLINK-12461

> Scala API unusable on Flink 1.18.1/Java 17 Docker image
> -------------------------------------------------------
>
>                 Key: FLINK-34658
>                 URL: https://issues.apache.org/jira/browse/FLINK-34658
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Scala
>    Affects Versions: 1.18.0, 1.18.1
>         Environment: This bug has been reproduced under macOS (Intel x64) and Linux (AMD 64) on a Flink cluster running in session mode.
>            Reporter: Matthew Ernst
>            Priority: Minor
>              Labels: Java17, docker, scala
>
> The Scala API should still work in Flink 1.18. The official Docker image for Flink 1.18.1 on Java 17 ("flink:1.18.1-scala_2.12-java17") causes jobs using the Scala API to immediately throw a ReflectiveOperationException. Jobs using the Scala API still work correctly on the Java 11 image ("flink:1.18.1-scala_2.12-java11").
> The problem happens because the flink-scala JAR file included in the image ("flink-scala_2.12-1.18.1.jar") has been built with an old Scala compiler that has a [compatibility bug with Java 17|https://github.com/scala/bug/issues/12419]. Rebuilding the flink-scala JAR file with the Scala compiler set to 2.12.15 or later fixes the bug. At my day job I cannot use Java 11 for a particular Flink job due to dependency on a Java library that uses [Java records|https://openjdk.org/jeps/395] (introduced in Java 16).
> I have created a github repository with an example application and a longer description of the bug and how to fix it with a newer Scala compiler version: https://github.com/mattbernst/scala-java17-flink



--
This message was sent by Atlassian Jira
(v8.20.10#820010)