Search code examples
scaladottyscala-3

What means this exception 'dotc: Bad symbolic reference.'


I want to work with Scala 3 and use some existing Libraries. The example works with Scala 2.13.

When compiling I get this exception:

dotc: Bad symbolic reference. A signature in ../dmn-engine-1.4.0.jar(org/camunda/dmn/parser/ParsedDmn.class)
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 ../dmn-engine-1.4.0.jar(org/camunda/dmn/parser/ParsedDmn.class).

Here is my build.sbt

lazy val extension = project
  .in(file("extension"))
  .settings(scalaVersion := dottyVersion,
    libraryDependencies ++= Seq(
      ("org.camunda.bpm.extension.dmn.scala" % "dmn-engine" % "1.4.0").withDottyCompat(scalaVersion.value),
      "com.novocode" % "junit-interface" % "0.11" % "test",
      "org.scalatest" %% "scalatest" % "3.2.2" % Test
    ),

    scalacOptions ++= {
      if (isDotty.value) Seq("-source:3.0-migration") else Nil
    }
  )

Update Ok, it works with 2.12, with 2.13 I get the following error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Serializable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    ...
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
    Caused by: java.lang.ClassNotFoundException: scala.Serializable
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 19 more

Solution

  • With figuring out that it only worked with Scala 2.12, I found the problem.

    The libraryDependencies "org.camunda.bpm.extension.dmn.scala" % "dmn-engine" % "1.4.0" refers to Scala 2.12.