Hi All, I am trying to upgrade Flink version 1.14...
# troubleshooting
a
Hi All, I am trying to upgrade Flink version 1.14.0 to 1.18.1, Java 8 to Java 17 and Scala 2.12.7 to Scala 3.4.1 but I am facing multiple errors like. • No Type tag available
Copy code
open class byname?
  type into[X0] = X0
  open abstract class AnyVal extends Any with Matchable {} at
    (scala : scala.type)
  final open abstract class Null extends Object {} at (scala : scala.type)
  final open trait Singleton extends Any {} at (scala : scala.type)
  final open class maybeCapability extends scala.annotation.StaticAnnotation {
    } at (scala : scala.type)
  type implicit
}
refers to Serializable/T in package scala which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling
• Multi-line script got printed as above • scala-reflect/2.12.7/scala-reflect-2.12.7.jar(scala/reflect/api/Exprs.class) Tried all 1.18.1 versions for compatibility but no luck. Any suggestion?
d
Let me try to unpack this since you mentioned several changes. First, I don’t that JDK is likely the issue although you could try JDK 11 as well if its acceptable for later versions of Scala. Most likely JDK is not the cause of this issue. I would be sure that the version you require is actually on the classpath however.
2.12.7-> 3.4.1 is a big jump! it’s worth it but it’s still a huge jump.
💯 1
The most likely cause is that you have upgraded to 3.4.1 while your project is still referencing 2.12 artifacts which are not compatible with Scala 3. You must ensure that all Scala-related dependencies are updated to their Scala 3 equivalents. Specifically mention of scala.reflect/2.12.7 indicate that your project is still referencing them. This is probably the root cause. You can try upgrading them as well and see if this particular error goes away.
Is it a prerequisite to upgrade of Scala 2.13.x first?
Can you share you build.sbt?
From what I can tell you need to first bump up everything to 2.13.x and then from there to 3.4.x
I am not sure you can migrate easily from 2.12.7 like this.
a
I am almost there and resolved all the errors. but somehow build is failing while running scala tests Flink version: 1.18.1 I am using Maven:
Copy code
<dependency>
  <groupId>org.apache.flink</groupId>
  <artifactId>flink-test-utils</artifactId>
  <version>${flink.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-scala_2.13</artifactId>
  <version>1.16.23</version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <groupId>org.scalactic</groupId>
      <artifactId>scalactic_2.13</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest_3</artifactId>
  <version>3.2.19</version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala3-library</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest-funsuite_3</artifactId>
  <version>3.2.17</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.scala-lang</groupId>
  <artifactId>scala3-library_3</artifactId>
  <version>${scala.version}</version>
</dependency>
while maven build its failing with reason: An exception or error caused a run to abort. This may have been caused by a problematic custom reporter. java.lang.NoClassDefFoundError: scala/Serializable at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) Caused by: java.lang.ClassNotFoundException: scala.Serializable at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ... 28 more Exception in thread "ScalaTest-main" java.lang.NoClassDefFoundError: scala/Serializable Does Scala 3.4.1 supports Mockito-scala ?
d
I am not aware that it does. You can check release notes and see maybe
Copy code
<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-scala_3</artifactId>
  <version>UPDATE_THIS_TO_CORRECT_VERSION</version>
  <scope>test</scope>
</dependency>

<!-- Scala 3 compatibility library, if needed -->
<dependency>
  <groupId>org.scala-lang</groupId>
  <artifactId>scala3-library-compat_3</artifactId>
  <version>${scala.version}</version>
</dependency>
Make sure to use a Mockito-Scala version compatible with Scala 3, if available but if not you will probably need compatibility library
if you can find library that is Scala 3.4.1 compatible be sure to exclude the older versions of it