I like to use developing and debugging engines with IntelliJ IDEA, but I got an error. I used this link: https://predictionio.apache.org/resources/intellij/.
Please guide me.
Error:
Exception in thread "main" java.lang.NoSuchMethodError: org.json4s.ParserUtil$.quote(Ljava/lang/String;)Ljava/lang/String;
at org.json4s.native.JsonMethods$$anonfun$2.apply(JsonMethods.scala:42)
at org.json4s.native.JsonMethods$$anonfun$2.apply(JsonMethods.scala:42)
at scala.collection.immutable.List.map(List.scala:284)
at org.json4s.native.JsonMethods$class.render(JsonMethods.scala:42)
at org.json4s.native.JsonMethods$.render(JsonMethods.scala:62)
at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2$$anonfun$2.apply(WorkflowUtils.scala:177)
at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2$$anonfun$2.apply(WorkflowUtils.scala:168)
at scala.Option.map(Option.scala:146)
at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2.apply(WorkflowUtils.scala:168)
at org.apache.predictionio.workflow.WorkflowUtils$$anonfun$getParamsFromJsonByFieldAndClass$2.apply(WorkflowUtils.scala:159)
at scala.Option.map(Option.scala:146)
at org.apache.predictionio.workflow.WorkflowUtils$.getParamsFromJsonByFieldAndClass(WorkflowUtils.scala:159)
at org.apache.predictionio.controller.Engine.jValueToEngineParams(Engine.scala:363)
at org.apache.predictionio.workflow.CreateWorkflow$.main(CreateWorkflow.scala:222)
at org.apache.predictionio.workflow.CreateWorkflow.main(CreateWorkflow.scala)
I had same issue and fix it changing the scala version to 2.11.3 in build.sbt.
The json library used by predictionio uses the scala's version 2.11.3 .
Related
I'm using intellij community 2018.3 with scala 2.12.
I try to generate scaladoc of my project (a library) but intellij print me this error:
Exception in thread "main" java.lang.NoSuchMethodError: scala.reflect.io.FileZipArchive.allDirsByDottedName()Lscala/collection/Map;
at scala.tools.nsc.classpath.ZipArchiveFileLookup.findDirEntry(ZipArchiveFileLookup.scala:71)
at scala.tools.nsc.classpath.ZipArchiveFileLookup.list(ZipArchiveFileLookup.scala:53)
at scala.tools.nsc.classpath.ZipArchiveFileLookup.list$(ZipArchiveFileLookup.scala:52)
at scala.tools.nsc.classpath.ZipAndJarClassPathFactory$ZipArchiveClassPath.list(ZipAndJarFileLookupFactory.scala:42)
at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$list$1(AggregateClassPath.scala:76)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
at scala.collection.Iterator.foreach(Iterator.scala:944)
at scala.collection.Iterator.foreach$(Iterator.scala:944)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
at scala.collection.IterableLike.foreach(IterableLike.scala:71)
at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike.map(TraversableLike.scala:234)
at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at scala.tools.nsc.classpath.AggregateClassPath.list(AggregateClassPath.scala:74)
at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:271)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:220)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1535)
at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:225)
at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:65)
at scala.tools.nsc.Global.rootMirror(Global.scala:63)
at scala.tools.nsc.Global.rootMirror(Global.scala:36)
at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:267)
at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:267)
at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1423)
at scala.tools.nsc.Global$Run.<init>(Global.scala:1179)
at scala.tools.nsc.doc.DocFactory.makeUniverse(DocFactory.scala:44)
at scala.tools.nsc.doc.DocFactory.generate$1(DocFactory.scala:124)
at scala.tools.nsc.doc.DocFactory.document(DocFactory.scala:131)
at scala.tools.nsc.ScalaDoc.process(ScalaDoc.scala:41)
at scala.tools.nsc.ScalaDoc$.main(ScalaDoc.scala:92)
at scala.tools.nsc.ScalaDoc.main(ScalaDoc.scala)
Process finished with exit code 1
IDE is update. What can I do?
It could be the following:
Also you are on scala 2.12, scala reflect seems to be on 2.11 or other version.
Add a dependency to scala reflect to your project:
https://mvnrepository.com/artifact/org.scala-lang/scala-reflect/2.12.8
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 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.
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).
I'm having some trouble getting the scala plugin to work with IntelliJ IDEA 10.5.1 Community Edition on Mac OSX 10.6.8. I'm following these instructions but whenever I try to run the simple HelloWorld application, I get this error:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7533 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/Users/A482930/IdeaProjects/ScalaPractice/out/production/ScalaPractice:/Users/A482930/scala/lib/scala-library.jar:/Users/A482930/scala/lib/scala-swing.jar:/Users/A482930/scala/lib/scala-dbc.jar:/Applications/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain HelloWorld
Exception in thread "main" java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Process finished with exit code 1
I checked the module settings and the compiler library seems to be set up correctly. The version of scala I'm using is the 2.9.0.1 with the IzPack Installer. I've tried both the IDEA plugin listed under available plugins as well as the July 5 2011 nightly here.
Rather then helping me troubleshoot my specific issue, does anyone know of a step by step tutorial that actually works without issues for a configuration similar to mine? I'm ok with using older versions of scala and even IDEA as long as they work.
I'm not sure you still need help with this, but I just ran a simple example with Scala 2.9.0.1 and it worked. I've been having tons of issues with the plugin though, so I guess it would help to know the exact steps you followed.
In my case, I did this:
Created Project
Added Scala Facet in the Project Wizard and added the Scala libs as a global lib (there are a few issues with this, but it should work here)
Create your HelloWorld example
Create a new Scala Compilation Server Runner. Add the Classpath of your project
Run the project
A colleague of mine created this some months ago, after having some issues getting started:
https://github.com/runeflobakk/sbt-idea-scalatest
Guess it is more SBT focused, but maybe you can find some use in it anyway?