Search code examples
scalaapache-flink

Flink 1.18.1 scala bridge not found


I'm migrating my project from Flink 1.14.5 to 1.18.1. I'm using scala API and SBT. When I'm trying to run my jar on my local machine (Windows 11) I'm having an error:

java.lang.NoClassDefFoundError: org/apache/flink/table/api/bridge/scala/StreamTableEnvironment$

Caused by: java.lang.ClassNotFoundException: org.apache.flink.table.api.bridge.scala.StreamTableEnvironment$

I've used before "provided" scope for scala bridge, like this:

val flinkScalaBridge = "org.apache.flink" %% "flink-table-api-scala-bridge" % flinkVersion % "provided"

It's compiling Ok but can't run my job from jar. When I'm removing "provided" scope I can run my job.

My question is: what's changed? Should I add scala-bridge to Flink /lib folder (or just use without provided) or maybe there is more changes and I should use different approach ?

UPDATE:

Scala users need to explicitly add a dependency to flink-table-api-scala or flink-table-api-scala-bridge.


Solution

  • As per the release notes of Flink 1.15 [1], a lot of the dependencies names have changed. You should check which dependencies you actually need:

    For Table / SQL users, the new module flink-table-planner-loader replaces flink-table-planner_2.12 and avoids the need for a Scala suffix. For backwards compatibility, users can still swap it with flink-table-planner_2.12 located in opt/. flink-table-uber has been split into flink-table-api-java-uber, flink-table-planner(-loader), and flink-table-runtime. Scala users need to explicitly add a dependency to flink-table-api-scala or flink-table-api-scala-bridge.

    [1] https://nightlies.apache.org/flink/flink-docs-stable/release-notes/flink-1.15/