I recently downgraded to Scala 2.8, and now whenever I try to initialise an actor, I get the following error message:
java.lang.NoSuchMethodError: scala.actors.ReactorCanReply$class.$init$(Lscala/actors/ReactorCanReply;)V
Apparently this guy had the same problem, but no solution was found. Has anyone else encountered this and solved it?
I thought that maybe there was some sonfusion going on in the background between Scala 2.8 and 2.9 files, so I've tried uninstalling and reinstalling both Scala and Eclipse, deleting all my binaries and rebuilding, and even creating a new Eclipse project and copying my source files in, but the problem persists.
My stack trace:
Exception in thread "main" java.lang.NoSuchMethodError: scala.actors.ReactorCanReply$class.$init$(Lscala/actors/ReactorCanReply;)V
at uk.mike.blackjack.PlayerReceiver.<init>(PlayerReceiver.scala:11)
at uk.mike.blackjack.Blackjack$.main(Blackjack.scala:141)
at uk.mike.blackjack.Blackjack.main(Blackjack.scala)
The Java bytecode compiled from Scala is not backward-compatible. You must recompile all your scala file and their dependencies when you upgrade to any new Scala version before Scala 2.10 releases.
BTW: Scala 2.10 promises to keep backward-compatible between all 2.10.x versions in the future.
Related
I added a dependency to the scala reflect library version 2.11.8 to one of my existing project such that I could use TypeTag's but strangely I face some error when running. Here is my error:
Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x10a3ab4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10b4ce4e0). One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.AbstractMethodError: Method com/my/csvparser/CSVParser$.scala$App$_setter_$executionStart_$eq(J)V is abstract
at com.my.csvparser.CSVParser$.scala$App$_setter_$executionStart_$eq(CSVParser.scala)
at scala.App$class.$init$(App.scala:44)
at com.my.csvparser.CSVParser$.<init>(CSVParser.scala:13)
at com.my.csvparser.CSVParser$.<clinit>(CSVParser.scala)
at com.my.csvparser.CSVParser.main(CSVParser.scala)
Did anyone face a similar issue? My Scala version is 2.11.8
I am using eclipse with m2eclipse-scala plugin. Currently, I get the following error message:
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
It looks like the versions of extracted Scala and Scala IDE match. I just wanted to make sure that this is a "false-negative" as described here and can be safely turned off.
As #The Archetypal Paul suggested, it was because I was using wrong Scala library.
If you are using Scala 2.11 (check at About Scala IDE -> installation details), you can downgrade by following instruction here. It's a lot easier than uninstalling and re-installing Scala IDE as other Stackoverflow posts recommend.
I also faced the same issue->
I am trying to use casbah jar in scala to integrate with mongodb.
After analyzing the problem i found that ->
i am trying to use casbah 2.9.1 version and my scala version is 2.11.8
Root-Cause of such error is : your jar is compiled in 2.9.0 version and you are using scala 2.11.8 version
So, to resolve that i use the jar that is compiled into 2.11 scala version-
<groupId>org.mongodb</groupId>
<artifactId>casbah-core_2.11</artifactId>
<version>3.1.1</version>
I was facing similar issue in Eclipse IDE where I had built a Spark scala project in Maven. The scala version was set to 2.11.
Later, I upgraded Scala-Ide plugin in Eclipse after which my project marked below errors,
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
Right click project folder > scala > set scala version. Here my scala version was displayed as 2.10. I selected 2.11 and removed all the error messages.
Sometimes when updating a dependency version for my project, when I would run the project I would get the following error:
ERROR 09:31:34:241 apply$mcV$sp - Class could not be loaded and/or registered: scala.Enumeration$Val
ERROR 09:31:34:247 apply$mcV$sp - exception caught during akka-kryo-serialization startup: java.lang.ClassNotFoundException: scala.Enumeration$Val
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
I usually got lucky and was able to fix this by tweaking the versions of my dependencies.
Until I updated my akka version from 2.3.6 to 2.3.12, specifically akka-contrib which contains akka-cluster, akka-remote and akka-peristance.
Turns out that the problem was actually occurring during the transition between akka 2.3.8 and 2.3.9. Looking at the change log, I found that between these two versions the Scala version was upgraded from 2.11.4 to 2.11.5.
My project was building on scala 2.11.4. Upgrading to 2.11.5 fixed the problem.
I couldn't find any help online for this, and lost a couple days trying to figure this out. I'm hoping that this will help someone else out.
I just updated my project to Scala 2.10.0 using SBT 0.12. But now, when running sbt, I get the following error:
java.lang.NoClassDefFoundError: scala/reflect/ManifestFactory$
at X.build.Unidoc$.<init>(Unidoc.scala:8)
at X.build.Unidoc$.<clinit>(Unidoc.scala)
at X.build.ServicesBuild$.<init>(Build.scala:25)
at X.build.ServicesBuild$.<clinit>(Build.scala)
It seems that the problem is on SettingKey:
8: val unidocDirectory = SettingKey[File]("unidoc-directory")
I heard that Scala 2.10 was doing reflects different than before and thought that that was the issue, yet the Akka project is doing the same exact thing and (I assume) they are doing fine.
https://github.com/akka/akka/blob/master/project/Unidoc.scala (my Unidoc.scala is pretty much a copy&paste of theirs).
Does anyone know what is happening? How can it not find a class in scala itself?
Thanks!
I'm trying to use Miles Sabin's HList of his Shapeless project. So I installed sbt from Macports (this is version 0.11).
Unfortunately, when launching sbt, I have the following error message:
java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
Search google seems to point that sbt-launch.jar would be in classpath. But even though I export CLASSPATH to "", I still have the issue.
I also directly downloaded the sbt-launch.jar from typesafe, and running with java -jar, with exactly the same problem.
Any idea? Other people having the same issue?
EDIT
I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar
I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).
I have had this error, and generally uninstalling Java, and installing it again will resolve it.
OP posted:
I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar
I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).