NoClassDefFoundError when running a Scala/Swing program with sbt - scala

I am trying to compile an old school project from around March, 2015. I haven’t touched it since then. The project is written in Scala with the Swing library, and the build tool is sbt.
Apparently my build.sbt file needs updating. After digging the Internet, I found that this configuration should work.
lazy val root = (project in file (".")).
settings (
name := "MyProgram",
/* FORMERLY: */
//libraryDependencies += "org.scala-lang" % "scala-swing" % "2.10+",
//ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
/* NOW: */
scalaVersion := "2.13.0",
libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % "2.1.1"
)
The trick would be to use compatible versions of Scala and Swing. I tried the following pairs, which I expected to work together (either because I saw them on the webpage of package Swing, or because it worked for other people on SO):
(Scala 2.13.0, Swing 2.1.1)
(Scala 2.12.6, Swing 2.1.1)
(Scala 2.12.1, Swing 2.0.0-M)
(Scala 2.11.1, Swing 1.0.2)
I also tried switching from Java 12 (jdk-openjdk 12.0.2.u10-1) to Java 8 (jdk8-openjdk 8.u222-2).
However, all combinations give the same error. Compiling (sbt compile) works fine, but running the application (sbt run) results in a bunch of NoClassDefFoundError / ClassNotFoundException errors:
$ sbt run
[info] Loading project definition from /home/me/MyProject/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to MyProject (in build file:/home/me/MyProject/)
[info] Compiling 22 Scala sources to /home/me/MyProject/target/scala-2.12/classes ...
[warn] there were four deprecation warnings (since 2.12.0); re-run with -deprecation for details
[warn] one warning found
[info] running Main.Main
[error] java.lang.NoClassDefFoundError: scala/swing/event/WindowOpened
[error] at scala.swing.Window$$anon$1.windowOpened(Window.scala:80)
...
[error] Caused by: java.lang.ClassNotFoundException: scala.swing.event.WindowOpened
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
...
[error] java.lang.NoClassDefFoundError: scala/swing/event/WindowActivated
[error] at scala.swing.Window$$anon$1.windowActivated(Window.scala:74)
...
[error] Caused by: java.lang.ClassNotFoundException: scala.swing.event.WindowActivated
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
...
The application’s main window shows up but is pretty unusable, with every GUI element generating more errors when activated; even trying to close the window via the window manager fails.
What is missing to run this program?

Related

chisel compilation error: object plugin is not a member of package chisel3.internal

I am studying chisel3 with a small trial project.
I finished code, fixed several syntax issues in compilation, then, it reported an error without indicating error file and line number.
$ sbt test
[info] welcome to sbt 1.4.9 (Red Hat, Inc. Java 1.8.0_292)
[info] loading settings for project fparser-build from plugins.sbt ...
[info] loading project definition from /mnt/disk1/yupeng/repos/fparser/project
[info] loading settings for project root from build.sbt ...
[info] set current project to fparser (in build file:/mnt/disk1/yupeng/repos/fparser/)
[info] compiling 3 Scala sources to /mnt/disk1/yupeng/repos/fparser/target/scala-2.12/classes ...
[error] ## Exception when compiling 3 sources to /mnt/disk1/yupeng/repos/fparser/target/scala-2.12/classes
[error] scala.reflect.internal.Types$TypeError: object plugin is not a member of package chisel3.internal
[error]
[error]
[error] scala.reflect.internal.Types$TypeError: object plugin is not a member of package chisel3.internal
[error] (Compile / compileIncremental) scala.reflect.internal.Types$TypeError: object plugin is not a member of package chisel3.internal
[error] Total time: 3 s, completed Jul 16, 2021 4:38:42 PM
what does it mean? please help.
I just found, the error is gone after I changed chisel3 versions in build.sbt.
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % "3.4.3",
// "edu.berkeley.cs" %% "chisel3" % "3.2.6", // this one generate plugin error above
"edu.berkeley.cs" %% "chiseltest" % "0.3.3" % "test",
"edu.berkeley.cs" %% "rocketchip" % "1.2.6"
Previously I changed from 3.4.3 to 3.2.6 because sbt warning of
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
I ran sbt evicted and it said rocketchip 1.2.6 should use chisel3 3.2.6.
Maybe someone can clarify.

Play Framework Scala Hello-World fail on Ubuntu 20

The basic Play Framework sample (play-scala-hello-world-tutorial) fails on Ubuntu 20 with OpenAdopt JDK but works fine on Macos. Is there something arry with my Linux setup?
Per https://www.playframework.com/getting-started) I...
> git clone https://github.com/playframework/play-samples.git
> cd play-samples/play-scala-hello-world-tutorial
> sbt run
[info] welcome to sbt 1.4.3 (AdoptOpenJDK Java 16)
[info] loading global plugins from /home/gp/.sbt/1.0/plugins
[info] loading settings for project play-scala-hello-world-tutorial-build from plugins.sbt,scaffold.sbt ...
[info] loading project definition from /home/.../play-samples/play-scala-hello-world-tutorial/project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] loading settings for project root from build.sbt ...
[info] set current project to play-scala-hello-world-tutorial (in build file:/home/.../play-samples/play-scala-hello-world-tutorial/)
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /[0:0:0:0:0:0:0:0]:9000
(Server started, use Enter to stop and go back to the console...)
curl localhost:9000
results in this:
play.api.UnexpectedException: Unexpected exception[UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:254)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:148)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:302)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:224)
at akka.stream.impl.fusing.MapAsync$$anon$30.onPush(Ops.scala:1297)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:495)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:390)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502)
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2051)
at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964)
at com.google.inject.internal.FailableCache.get(FailableCache.java:54)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:155)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:592)
at com.google.inject.internal.AbstractBindingProcessor$Processor.initializeBinding(AbstractBindingProcessor.java:173)
Caused by: java.lang.IllegalStateException: Unable to load cache item
at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:79)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:258)
at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:207)
at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:49)
at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:156)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:94)
Caused by: java.lang.ExceptionInInitializerError: null
at com.google.inject.internal.cglib.core.$DuplicatesPredicate.evaluate(DuplicatesPredicate.java:104)
at com.google.inject.internal.cglib.core.$CollectionUtils.filter(CollectionUtils.java:52)
at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:69)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:332)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Caused by: com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #5f574e3d
at com.google.inject.internal.cglib.core.$ReflectUtils.defineClass(ReflectUtils.java:464)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:339)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)
at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:294)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #5f574e3d
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at com.google.inject.internal.cglib.core.$ReflectUtils$1.run(ReflectUtils.java:61)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:52)
at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
>java -version
openjdk version "16" 2021-03-16
OpenJDK Runtime Environment AdoptOpenJDK (build 16+36)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16+36, mixed mode, sharing)
> sbt sbtVersion
[info] welcome to sbt 1.3.13 (AdoptOpenJDK Java 16)
[info] loading global plugins from /home/../.sbt/1.0/plugins
[info] loading settings for project play-scala-hello-world-tutorial-build from scaffold.sbt,plugins.sbt ...
[info] loading project definition from /home/.../play-samples/play-scala-hello-world-tutorial/project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] loading settings for project root from build.sbt ...
[info] set current project to play-scala-hello-world-tutorial (in build file:/home/.../play-samples/play-scala-hello-world-tutorial/)
[info] 1.3.13
project/build.properties:
# sbt.version=1.3.13
sbt.version=1.4.3
I was having the same issue with JDK-11
Trying with Java8 solved the issue.
For me is the opposite of #ProofJS's solution. On Windows 10,
JDK8 would not work (it would not compile - sbt compile). JDK 11 worked without problems. JDK 17 did compile, but would not run - sbt run.
welcome to sbt 1.3.13 (Oracle Corporation Java 11.0.12)
In IntelliJ, in the context menu for the project (right click) -> Open Module Settings -> Project -> SDK 11.0.12.
build.properties (file):
sbt.version=1.3.13
plugins.sbt (file):
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.11")
build.sbt (file):
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(
name := """play-scala-forms-example""",
version := "2.8.x",
scalaVersion := "2.13.7",
libraryDependencies ++= Seq(
guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test,
),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-Xfatal-warnings"
)
)
System Env: JAVA_HOME & Path set to JDK-11/bin
Play 2.8.16 is dependent on google Guice version 4.2.3, which only support jdk 14, to make this run with java 17, you need to add the following code snippet into your build.sbt
dependencyOverrides ++= Seq(
"com.google.inject" % "guice" % "5.1.0",
"com.google.inject.extensions" % "guice-assistedinject" % "5.1.0")
Here are few links you can have a look :-
https://github.com/google/guice/wiki/Guice423
https://github.com/google/guice/wiki/Guice510
https://github.com/playframework/playframework/releases/2.8.15
Adding the above snippet code would make it able to run with 17.

Error downloading net.cakesolutions:scala-kafka-client - Not Found

I'm trying to install Kafka in my sbt, but when I click on "import changes" I'm getting an error:
[error] stack trace is suppressed; run 'last update' for the full
output [error] stack trace is suppressed; run 'last
ssExtractDependencies' for the full output [error] (update)
sbt.librarymanagement.ResolveException: Error downloading
net.cakesolutions:scala-kafka-client_2.13:2.3.1 [error] Not found
[error] Not found [error] not found:
C:\Users\macca.ivy2\local\net.cakesolutions\scala-kafka-client_2.13\2.3.1\ivys\ivy.xml
[error] not found:
https://repo1.maven.org/maven2/net/cakesolutions/scala-kafka-client_2.13/2.3.1/scala-kafka-client_2.13-2.3.1.pom
[error] (ssExtractDependencies)
sbt.librarymanagement.ResolveException: Error downloading
net.cakesolutions:scala-kafka-client_2.13:2.3.1 [error] Not found
[error] Not found [error] not found:
C:\Users\macca.ivy2\local\net.cakesolutions\scala-kafka-client_2.13\2.3.1\ivys\ivy.xml
[error] not found:
https://repo1.maven.org/maven2/net/cakesolutions/scala-kafka-client_2.13/2.3.1/scala-kafka-client_2.13-2.3.1.pom
[error] Total time: 1 s, completed 19:56:34 26/04/2020 [info] shutting
down sbt server
build.sbt:
name := "KafkaProducer"
version := "0.1"
scalaVersion := "2.13.0"
libraryDependencies ++= Seq(
"io.circe" %% "circe-parser" % "0.12.3",
"net.cakesolutions" %% "scala-kafka-client" % "2.3.1"
)
Per the github page for scala-kafka-client, you'll need to add a bintray resolver to your build.sbt:
resolvers += Resolver.bintrayRepo("cakesolutions", "maven")
As of today Scala is still not binary compatible between versions and has tendency to serious breaking changes between "minor" (2.10 -> 2.11 -> 2.12 -> 2.13) releases.
It leads to situation where maintainers are relatively slow in adopting new versions.
e.g. Apache Spark barely started supporting 2.12 in the last stable version.
And even to the point where it is a default one.
So if I want to run this with 2.13 I have three options:
sbt publish-local
Using standard Java client instead
Nagging maintainer of Scala package to publish artificats
But I've decided to solve it by just downgrading Scala to 2.12

Scala SBT compile error

I have been following this tutorial to learn how to use Akka HTTP with Scala. I have no prior experience with Scala. I'm using IntelliJ Idea 2016.3 Ultimate.
I created a project and configured as the guide says.
name := "My Project"
version := "1.0"
scalaVersion := "2.9.1"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0"
I have the exactly same code as in the guide but when I run the SBT command compile I get the following error
[info] Updating {file:/Users/Javyer/Testing/Akka-Test/}akka-test...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/Javyer/Testing/Akka-Test/target/scala-2.9.1/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.9.1.final. Compiling...
error: error while loading CharSequence, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
(bad constant pool tag 18 at byte 10)
error: error while loading AnnotatedElement, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken
(bad constant pool tag 18 at byte 76)
error: error while loading Arrays, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar(java/util/Arrays.class)' is broken
(bad constant pool tag 18 at byte 765)
error: error while loading Comparator, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar(java/util/Comparator.class)' is broken
(bad constant pool tag 18 at byte 20)
/var/folders/kw/80c0kgzs0b9d06vjrbx0l6g40000gn/T/sbt_139df807/xsbt/ExtractAPI.scala:549: error: java.util.Comparator does not take type parameters
private[this] val sortClasses = new Comparator[Symbol] {
^
5 errors found
[info] Resolving org.scala-sbt#interface;0.13.13 ...
[error] (compile:compileIncremental) Error compiling sbt component 'compiler-interface'
[error] Total time: 5 s, completed Mar 22, 2017 11:42:21 AM
If I change my build.sbt to a more recent version of the akka libraries
name := "Akka-Test"
version := "1.0"
scalaVersion := "2.12.1"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.17",
"com.typesafe.akka" %% "akka-remote" % "2.4.17"
)
and compile again I get a different error
[info] Updating {file:/Users/Javyer/Testing/Akka-Test/}akka-test...
[info] Resolving jline#jline;2.14.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/Javyer/Testing/Akka-Test/target/scala-2.12/classes...
[error] /Users/Javyer/Testing/Akka-Test/src/main/scala/Pi.scala:5: object RoundRobinRouter is not a member of package akka.routing
[error] import akka.routing.RoundRobinRouter
[error] ^
[error] /Users/Javyer/Testing/Akka-Test/src/main/scala/Pi.scala:6: object Duration is not a member of package akka.util
[error] import akka.util.Duration
[error] ^
[error] /Users/Javyer/Testing/Akka-Test/src/main/scala/Pi.scala:7: object duration is not a member of package akka.util
[error] import akka.util.duration._
[error] ^
[error] /Users/Javyer/Testing/Akka-Test/src/main/scala/Pi.scala:17: not found: type Duration
[error] case class PiApproximation(pi: Double, duration: Duration)
[error] ^
[error] /Users/Javyer/Testing/Akka-Test/src/main/scala/Pi.scala:40: not found: value RoundRobinRouter
[error] val workerRouter = context.actorOf(Props[Worker].withRouter(RoundRobinRouter(nrOfWorkers)), name = "workerRouter")
[error] ^
[error] 5 errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed Mar 22, 2017 11:47:47 AM
How can I fix this? I don't know how to debug this error nor where to start tackling this problem. As I said, this is my first test with Scala so I don't have any prior experience with it, so, please, give me detail answers.
Thanks!
First error: Scala 2.9.x requires JVM runtime v 1.6 or 1.7, while you are using 1.8, which wouldn't work as we can clearly see from the message ('broken class' means that the runtime doesn't understand the structure of the files you are feeding it).
Second error requires a bit more context, could you post the code? I'm 99% sure you follow some outdated example, but use fresh library releases. E.g. there's no Duration in akka.util, no RoundRobinRouter in akka.routing etc.
I would suggest you to spend some time exploring/tweaking available samples, e.g. this one: https://github.com/akka/akka-samples/tree/master/akka-sample-main-scala.
Also, note that akka evolves pretty fast, but has a solid documentation versioning support, so for each library release there's a separate documentation section on the site. You'll be notified about this at leas once a day when you visit an outdated release documentation page. Here's the link to he 2.4.17 docs: http://doc.akka.io/docs/akka/2.4.17/scala.html
There are 2 options:
Using java 7 with scala 2.7.2
Using another version of scala (2.11.4), and java 8:
Example build.sbt
scalaVersion := Option(System.getProperty("scala.version")).getOrElse("2.11.4")

My First Akka project in IntelliJ from scratch. Compile dependency error.

Every now and then I start things from scratch to make sure I know what all the intricate details of setting up a project are. I have a simple app like the following but I get some dependency issues that don't seem to point me anywhere. I'm using scala verions 2.11.
My SBT:
name := "Helios"
version := "1.0"
scalaVersion := "2.11.8"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"com.typesafe.akka" % "akka-actor" % "2.0.2",
"com.typesafe.akka" % "akka-slf4j" % "2.0.5")
My Sample Class
import com.echostar.ese.helios.core.Asset
import akka.actor._
class NSPSG extends Actor {
def receive = {
case a: Asset => {
println(s"NSPSG Received asset: ${a}")
}
case _ => println("Unexpected message received")
}
}
(Asset class is just a case class with id and title in it.)
Error Message:
C:\PROJECTS\active\Helios>sbt compile
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\dana.murad\.sbt\0.13\plugins
[info] Loading project definition from C:\PROJECTS\active\Helios\project
[info] Set current project to Helios (in build file:/C:/PROJECTS/active/Helios/)
[info] Updating {file:/C:/PROJECTS/active/Helios/}helios...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 3 Scala sources to C:\PROJECTS\active\Helios\target\scala-2.11\classes...
[error] missing or invalid dependency detected while loading class file 'package.class'.
[error] Could not access type ScalaObject in package scala,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'package.class' was compiled against an incompatible version of scala.
[error] missing or invalid dependency detected while loading class file 'Actor.class'.
[error] Could not access type ScalaObject in package scala,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'Actor.class' was compiled against an incompatible version of scala.
[error] C:\PROJECTS\active\Helios\src\main\scala\com\echostar\ese\helios\workers\NSPSG.scala:9: illegal inheritance;
[error] self-type com.echostar.ese.helios.workers.NSPSG does not conform to akka.actor.Actor's selftype akka.actor.Actor
[error] class NSPSG extends Actor {
[error] ^
[error] three errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 3 s, completed Apr 4, 2016 9:19:45 AM
My main App is just a println for now. It's not even calling this actor.
Am I using the wrong version of akka with scala 2.11? -Ylog-classpath didn't help
Don't know what fixed it but here's a list of things I did and the project compiles now.
Changed akka dependency line to this (added double percent and changed version back to 2.4)
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.0"
)
Removed my Run configuration and added it back again. ( I think the path to main showed as red (invalid) so redoing it helped resolve it. I changed my package name and I don't think intelliJ picked up the rename well in build-conf)
Started another test project from IntelliJ menu (Akka Main in Scala) and that took a bit to download all dependencies. So maybe my project needed those and wasn't download them?
Removed commented out lines (got rid of a semi-colon). I don't think this did anything but full disclosure, technically I did touch the code even though my actor definition is exactly the same.