Domanda

I have a working Akka application implemented with Maven/Java/Scala and now I would like to integrate it with the Typesafe Console. Therefore I downloaded the full binary distribution here and it nicely contains a sample Maven project. However, after integrating the changes into my project it doesn't work.

I first get the following:

[WARN] [11/19/2013 14:36:11.047] [xxx.MapReduceNode.main()] [EventStream(akka://MapReduceNode)] [akka.event-handlers] config is deprecated, use [akka.loggers]

meaning akka.event-handlers is deprecated?? but I'm using the suggested version of Scala, Atoms trace etc. The current documentation also recommends the use akka.event-handlers see here.

Right next to this warning I get the erorr

[ERROR] [11/19/2013 14:36:11.074] [MapReduceNode-akka.actor.default-dispatcher-3] [ActorSystem(MapReduceNode)] Uncaught error from thread [MapReduceNode-akka.actor.default-dispatcher-3] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.NoClassDefFoundError: com/typesafe/atmos/trace/Tracer$
    at com.typesafe.atmos.trace.Slf4jTraceContextEventHandler$$anonfun$addContext$1.applyOrElse(Slf4jTraceContextEventHandler.scala:17)
    at scala.PartialFunction$AndThen.applyOrElse(PartialFunction.scala:184)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498)
    at akka.actor.ActorCell.invoke(ActorCell.scala:456)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237)
    at akka.dispatch.Mailbox.run(Mailbox.scala:219)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ClassNotFoundException: com.typesafe.atmos.trace.Tracer$
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 11 more

which is quite shocking given that the Maven project compiles fine. This seems like a dependency version clash. I investigated a bit further and using mvn depencency:tree I found no version conflicts in my project dependencies.

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ hpcmom-mapreduce ---
[INFO] xxx:hpcmom-mapreduce:jar:1.0-SNAPSHOT
[INFO] +- xxx:hpcmom-commons:jar:1.0-SNAPSHOT:compile
[INFO] +- org.scala-lang:scala-library:jar:2.10.2:compile
[INFO] +- com.typesafe.atmos:trace-akka-2.1.4:jar:1.3.1:compile
[INFO] +- com.typesafe.akka:akka-actor_2.10:jar:2.2.3:compile
[INFO] |  \- com.typesafe:config:jar:1.0.2:compile
[INFO] +- com.typesafe.akka:akka-remote_2.10:jar:2.2.3:compile
[INFO] |  +- io.netty:netty:jar:3.6.6.Final:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:2.4.1:compile
[INFO] |  \- org.uncommons.maths:uncommons-maths:jar:1.2.2a:compile
[INFO] +- com.typesafe.akka:akka-kernel_2.10:jar:2.2.3:compile
[INFO] +- com.typesafe.akka:akka-agent_2.10:jar:2.2.3:compile
[INFO] |  \- org.scala-stm:scala-stm_2.10:jar:0.7:compile
[INFO] +- com.typesafe.akka:akka-zeromq_2.10:jar:2.2.3:compile
[INFO] |  \- org.zeromq:zeromq-scala-binding_2.10:jar:0.0.7:compile
[INFO] |     +- net.java.dev.jna:jna:jar:3.0.9:compile
[INFO] |     \- com.github.jnr:jnr-constants:jar:0.8.2:compile
[INFO] +- com.typesafe.akka:akka-slf4j_2.10:jar:2.2.3:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- com.google.guava:guava:jar:15.0:compile
[INFO] +- org.scalatest:scalatest_2.10:jar:2.0.M8:test
[INFO] \- junit:junit:jar:4.11:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
È stato utile?

Soluzione

The first thing I see that is a problem is your tracing artifacts don't match your version of Akka. From your tree I can see you're using Akka 2.2.3:

[INFO] +- com.typesafe.akka:akka-kernel_2.10:jar:2.2.3:compile

but your tracing jar is for Akka 2.1

[INFO] +- com.typesafe.atmos:trace-akka-2.1.4:jar:1.3.1:compile

From here: http://resources.typesafe.com/docs/console/manual/getting-started.html#instrumentation

Your artifact for tracing Akka should be:

<dependency>
  <groupId>com.typesafe.atmos</groupId>
  <artifactId>trace-akka-2.2.1_2.10</artifactId>
  <version>1.3.1</version>
</dependency>

And yes, in Akka 2.2 the logging configuration has changed: http://doc.akka.io/docs/akka/2.2.3/scala/logging.html

To use the console logger you need:

loggers = ["com.typesafe.atmos.trace.Slf4jTraceContextLogger"]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top