I am getting exception while running Scala Worksheet in intellij - scala

I am using Scala 2.11.8 and running simple program in Scala worksheet.
I am getting the below error. Please let me know if I am missing anything here.
Internal error: null
org.jetbrains.jps.incremental.scala.remote.ClientEventProcessor.process(ClientEventProcessor.scala:22)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner.handle(RemoteResourceOwner.scala:47)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner.handle$(RemoteResourceOwner.scala:37)
org.jetbrains.plugins.scala.compiler.RemoteServerRunner.handle(RemoteServerRunner.scala:14)
org.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner.$anonfun$send$5(RemoteResourceOwner.scala:30)

Related

ClassNot found exception in helloworld program in scala

I am new to IntelliJ and scala and I am writing a helloworld program in sbt. But I am getting below error message :
(https://i.stack.imgur.com/SwL9Y.png)
Check if you have defined a JDK and Scala SDK in your Module Settings (F4)
enter image description here
Can you tell me what I am missing here

Strange Scala Error when Using Scala Reflect

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

Spark Scala API: No typeTag available in spark.createDataFrame in official example

I just started working with the MLib for Spark and tried to run the provided examples, more specifically https://github.com/apache/spark/blob/master/examples/src/main/scala/org/apache/spark/examples/ml/DCTExample.scala
However, compilation using the IntelliJ IDE fails with the message
Error:(41, 35) No TypeTag available for (org.apache.spark.ml.linalg.Vector,)
val df = spark.createDataFrame(data.map(Tuple1.apply)).toDF("features")
The project setup uses jdk1.8.0_121, spark2.11-2.1.0 and scala 2.10.6.
Any ideas on why the example fails to run? I followed the following tutorial during installation: https://www.supergloo.com/fieldnotes/intellij-scala-spark/
You can't have spark for Scala 2.11 (that's what _2.11 in the name means) with Scala 2.10, though this specific error looks quite strange. Switch to Scala 2.11.8.

error: not found: value sc

I am new to Scala and am trying to code read a file using the following code
scala> val textFile = sc.textFile("README.md")
scala> textFile.count()
But I keep getting the following error
error: not found: value sc
I have tried everything, but nothing seems to work. I am using Scala version 2.10.4 and Spark 1.1.0 (I have even tried Spark 1.2.0 but it doesn't work either). I have sbt installed and compiled yet not able to run sbt/sbt assembly. Is the error because of this?
You should run this code using ./spark-shell. It's scala repl with provided sparkContext. You can find it in your apache spark distribution in folder spark-1.4.1/bin.

sbt can't find scala.reflect.Manifest when getting Unidoc.scala settings with scala 2.10.0

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!