You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Aljoscha Krettek (JIRA)" <ji...@apache.org> on 2019/05/13 10:15:00 UTC

[jira] [Commented] (FLINK-12462) Classloading fails in 1.8.0 when Scalatest is loaded first

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

Aljoscha Krettek commented on FLINK-12462:
------------------------------------------

I think there is nothing we can do because Scala is breaking binary compatibility between minor versions. It's a shame, but I'm closing this for now because there exists a workaround of manually forcing the correct dependencies.

> Classloading fails in 1.8.0 when Scalatest is loaded first
> ----------------------------------------------------------
>
>                 Key: FLINK-12462
>                 URL: https://issues.apache.org/jira/browse/FLINK-12462
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Scala
>    Affects Versions: 1.8.0
>            Reporter: Gaƫl Renoux
>            Priority: Major
>
> When using Flink 1.8.0 and Scala 2.11.12, if Scalatest is loaded first and I use some class from the Scala library, I get a: java.lang.ClassNotFoundException: scala.reflect.io.JavaToolsPlatformArchive
> To reproduce:
> - start with the Scala Maven archetype (org.apache.flink:flink-quickstart-scala:1.8.0)
> - in the POM, add a Scalatest dependency with test scope, before the Flink dependencies (org.scalatest:scalatest_${scala.binary.version}:3.0.4:test)
> - in StreamingJob, add: env.fromElements[List[String]]()
> I got a similar issue using Scala 2.12.7: java.lang.ClassNotFoundException: scala.reflect.internal.SymbolTable$ReflectStats
> It works when changing the Flink version to 1.7.2. It also works if Flink is loaded first, but this can be a bit harder to ensure sometimes (our own POM has a few profile definitions).
> I also managed to make it work by forcing the following dependency: org.scala-lang:scala-reflect:${scala.version}. Looking at the dependency tree, it looks like Flink needs the most recent version of scala-reflect but somehow doesn't enforce it. When Scalatest is loaded first, the version it declares (wich is slightly older: 2.11.11 or 2.12.3) gets used instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)