Reputation: 51109
Trying the Coursera Spark/bigdata course, and getting the following error when trying to use the console
command in sbt. After the stack trace, the scala >
prompt appears, but the console doesn't work properly since no text appears when I type. Tried both the "example" and "wikipedia" assignments; same thing. They do compile OK and pass tests - it's just that I can't use the sbt console.
It's odd because the console does work fine with other projects, in particular the Coursera progfun2 course, which has a very similar build file.
C:\Users\Rhys\Documents\Java\SbtProjects\example>sbt
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading global plugins from C:\Users\Rhys\.sbt\0.13\plugins
[info] Loading project definition from C:\Users\Rhys\Documents\Java\SbtProjects\example\project
[info] Updating {file:/C:/Users/Rhys/Documents/Java/SbtProjects/example/project/}example-build...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-c5d1b95fdcc1e1007740ffbecf4eb07[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 7 Scala sources to C:\Users\Rhys\Documents\Java\SbtProjects\example\project\target\scala-2.10\sbt-0.13\classes...
[info] Set current project to bigdata-example (in build file:/C:/Users/Rhys/Documents/Java/SbtProjects/example/)
> console
[info] Compiling 1 Scala source to C:\Users\Rhys\Documents\Java\SbtProjects\example\target\scala-2.11\classes...
[info] Starting scala interpreter...
[info]
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.NoClassDefFoundError: Could not initialize class scala.tools.fusesource_embedded.jansi.internal.Kernel32
at scala.tools.fusesource_embedded.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:50)
at scala.tools.jline_embedded.WindowsTerminal.getConsoleMode(WindowsTerminal.java:204)
at scala.tools.jline_embedded.WindowsTerminal.init(WindowsTerminal.java:82)
at scala.tools.jline_embedded.TerminalFactory.create(TerminalFactory.java:101)
at scala.tools.jline_embedded.TerminalFactory.get(TerminalFactory.java:158)
at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:229)
at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:221)
at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:209)
at scala.tools.nsc.interpreter.jline_embedded.JLineConsoleReader.<init>(JLineReader.scala:62)
at scala.tools.nsc.interpreter.jline_embedded.InteractiveReader.<init>(JLineReader.scala:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at scala.tools.nsc.interpreter.ILoop$$anonfun$scala$tools$nsc$interpreter$ILoop$$instantiater$1$1.apply(ILoop.scala:858)
at scala.tools.nsc.interpreter.ILoop$$anonfun$scala$tools$nsc$interpreter$ILoop$$instantiater$1$1.apply(ILoop.scala:855)
at scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$mkReader$1(ILoop.scala:862)
at scala.tools.nsc.interpreter.ILoop$$anonfun$21$$anonfun$apply$9.apply(ILoop.scala:873)
at scala.tools.nsc.interpreter.ILoop$$anonfun$21$$anonfun$apply$9.apply(ILoop.scala:873)
at scala.util.Try$.apply(Try.scala:192)
at scala.tools.nsc.interpreter.ILoop$$anonfun$21.apply(ILoop.scala:873)
at scala.tools.nsc.interpreter.ILoop$$anonfun$21.apply(ILoop.scala:873)
at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1233)
at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1223)
at scala.collection.immutable.Stream.collect(Stream.scala:435)
at scala.tools.nsc.interpreter.ILoop.chooseReader(ILoop.scala:875)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1$$anonfun$apply$mcZ$sp$2.apply(ILoop.scala:914)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:914)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909)
at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:909)
at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:934)
at xsbt.ConsoleInterface.run(ConsoleInterface.scala:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:76)
at sbt.Console.sbt$Console$$console0$1(Console.scala:22)
at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:23)
at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
at sbt.Logger$$anon$4.apply(Logger.scala:85)
at sbt.TrapExit$App.run(TrapExit.scala:248)
at java.lang.Thread.run(Unknown Source)
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.
scala>
Here's the build.sbt
if it's any help:
name := course.value + "-" + assignment.value
scalaVersion := "2.11.8"
scalacOptions ++= Seq("-deprecation")
courseId := "e8VseYIYEeWxQQoymFg8zQ"
resolvers += Resolver.sonatypeRepo("releases")
// grading libraries
libraryDependencies += "junit" % "junit" % "4.10" % "test"
libraryDependencies ++= assignmentsMap.value.values.flatMap(_.dependencies).toSeq
// include the common dir
commonSourcePackages += "common"
assignmentsMap := {
val depsSpark = Seq(
"org.apache.spark" %% "spark-core" % "2.1.0"
)
Map(
"example" -> Assignment(
packageName = "example",
key = "9W3VuiJREeaFaw43_UrNUw",
itemId = "I6L8m",
partId = "vsJoj",
maxScore = 10d,
dependencies = Seq(),
options = Map("Xmx"->"1540m", "grader-memory"->"2048")),
"wikipedia" -> Assignment(
packageName = "wikipedia",
key = "EH8wby4kEeawURILfHIqjw",
itemId = "QcWcs",
partId = "5komc",
maxScore = 10d,
styleScoreRatio = 0.0,
dependencies = depsSpark,
options = Map("Xmx"->"1540m", "grader-memory"->"2048", "totalTimeout" -> "900", "grader-cpu" -> "2")),
"stackoverflow" -> Assignment(
packageName = "stackoverflow",
key = "7ByAoS4kEea1yxIfJA1CUw",
itemId = "FWGnz",
partId = "OY5fJ",
maxScore = 10d,
styleScoreRatio = 0.0,
dependencies = depsSpark,
options = Map("Xmx"->"1540m", "grader-memory"->"2048", "totalTimeout" -> "900", "grader-cpu" -> "2")),
"timeusage" -> Assignment(
packageName = "timeusage",
key = "mVk0fgQ0EeeGZQrYVAT1jg",
itemId = "T19Ec",
partId = "y8PO8",
maxScore = 10d,
styleScoreRatio = 0.0,
dependencies = depsSpark :+ ("org.apache.spark" %% "spark-sql" % "2.1.0"),
options = Map("Xmx"->"1540m", "grader-memory"->"2048", "totalTimeout" -> "900", "grader-cpu" -> "2"))
)
}
Looks like I encountered a similar problem with jansi starting the REPL a few years ago, but this time the solution of del %TEMP%\jansi.dll
reports that there's no such file.
Upvotes: 3
Views: 1108
Reputation: 126
This is due to an issue in the 'coursier' library referenced by the projects in the assignments for this Coursera class.
It looks like the issue was Windows specific, and was resolved about a month ago (~Feb 2017). See here: https://github.com/coursier/coursier/issues/274. And thankfully a newer build of the 'coursier' library is available with this fix.
So the solution is to have the projects for your assignments use this newer, fixed, version of the library. To do this change the related text in 'project\plugins.sbt' inside the assignment folder from
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15")
to
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15-5") // or really anything past M15-3 it seems, but M15-5 is currently 'newest'
And then you should be good to go!
Upvotes: 5