akka.dispatch.Envelope cannot be cast to akka.kamon.instrumentation.InstrumentedEnvelope

368 views
Skip to first unread message

Manoj Santhakumaran

unread,
May 10, 2016, 9:05:46 PM5/10/16
to kamon-user
Hi,

I'm trying to integrate Kamon in my Akka application (Not Play, only Akka system), and I'm getting the following exception when starting the system.

Java : 1.8
Akka version: 2.4.0
Kamon : 0.6.0 (I also tried with latest 0.6.1 but same result)

I appreciate any help to resolve this issue.

Thank you very much.
Manoj

[INFO] [05/10/2016 17:23:43.272] [main] [LogReporterExtension(akka://kamon)] Starting the Kamon(LogReporter) extension
[INFO] [05/10/2016 17:23:43.331] [main] [StatsDExtension(akka://kamon)] Starting the Kamon(StatsD) extension
[ERROR] [05/10/2016 17:23:43.667] [kamon-akka.actor.default-dispatcher-2] [akka://kamon/system/IO-UDP-FF] akka.dispatch.Envelope cannot be cast to akka.kamon.instrumentation.InstrumentedEnvelope
java.lang.ClassCastException: akka.dispatch.Envelope cannot be cast to akka.kamon.instrumentation.InstrumentedEnvelope
    at akka.kamon.instrumentation.ActorCellInstrumentation.afterSendMessageInActorCell(ActorInstrumentation.scala:60)
    at akka.routing.RoutedActorCell.sendMessage_aroundBody0(RoutedActorCell.scala:138)
    at akka.routing.RoutedActorCell$AjcClosure1.run(RoutedActorCell.scala:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at akka.kamon.instrumentation.NoOpRouterMonitor$.processMessage(RouterMonitor.scala:35)
    at akka.kamon.instrumentation.RoutedActorCellInstrumentation.aroundSendMessageInRouterActorCell(RouterInstrumentation.scala:29)
    at akka.routing.RoutedActorCell.sendMessage(RoutedActorCell.scala:138)
    at akka.actor.Cell$class.sendMessage(ActorCell.scala:294)
    at akka.actor.ActorCell.sendMessage(ActorCell.scala:373)
    at akka.actor.RepointableActorRef.$bang(RepointableActorRef.scala:166)
    at akka.io.SelectionHandler$SelectorBasedManager$$anonfun$workerForCommandHandler$1.applyOrElse(SelectionHandler.scala:87)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:480)
    at akka.io.SelectionHandler$SelectorBasedManager.aroundReceive(SelectionHandler.scala:78)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:525)
    at akka.actor.ActorCell.invoke(ActorCell.scala:494)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
    at akka.dispatch.Mailbox.run(Mailbox.scala:224)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
    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)

[ERROR] [05/10/2016 17:23:43.751] [kamon-akka.actor.default-dispatcher-8] [akka://kamon/system/IO-UDP-FF/selectors] null
akka.actor.ActorInitializationException: exception during creation
    at akka.actor.ActorInitializationException$.apply(Actor.scala:172)
    at akka.actor.ActorCell.create(ActorCell.scala:605)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:460)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:482)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)
    at akka.dispatch.Mailbox.run(Mailbox.scala:223)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
    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.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at akka.util.Reflect$.instantiate(Reflect.scala:65)
    at akka.actor.ArgsReflectConstructor.produce(Props.scala:348)
    at akka.actor.Props.newActor(Props.scala:259)
    at akka.actor.ActorCell.newActor(ActorCell.scala:561)
    at akka.actor.ActorCell.create(ActorCell.scala:587)
    ... 9 more
Caused by: java.lang.NullPointerException
    at akka.kamon.instrumentation.DispatcherInstrumentation.afterCreateExecutorService(DispatcherInstrumentation.scala:115)
    at akka.dispatch.ThreadPoolConfig$ThreadPoolExecutorServiceFactory.createExecutorService(ThreadPoolBuilder.scala:88)
    at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.executor$lzycompute(Dispatcher.scala:44)
    at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.executor(Dispatcher.scala:44)
    at akka.dispatch.ExecutorServiceDelegate$class.execute(ThreadPoolBuilder.scala:212)
    at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.execute(Dispatcher.scala:43)
    at akka.dispatch.Dispatcher.executeTask(Dispatcher.scala:76)
    at akka.dispatch.MessageDispatcher.unbatchedExecute(AbstractDispatcher.scala:143)
    at akka.dispatch.BatchingExecutor$class.execute(BatchingExecutor.scala:123)
    at akka.dispatch.MessageDispatcher.execute(AbstractDispatcher.scala:83)
    at akka.util.SerializedSuspendableExecutionContext.attach(SerializedSuspendableExecutionContext.scala:75)
    at akka.util.SerializedSuspendableExecutionContext.execute(SerializedSuspendableExecutionContext.scala:76)
    at akka.io.SelectionHandler$ChannelRegistryImpl.<init>(SelectionHandler.scala:151)
    at akka.io.SelectionHandler.<init>(SelectionHandler.scala:234)
    ... 18 more

[INFO] [05/10/2016 17:23:52.858] [kamon-akka.actor.default-dispatcher-7] [akka://kamon/user/kamon-log-reporter] No metrics reported

Diego Parra

unread,
May 11, 2016, 9:13:26 AM5/11/16
to kamon...@googlegroups.com
Hey manoj,

it is really weird. you can provide us a really simple example in order to catch this issue.

Cheers,

Diego

--
You received this message because you are subscribed to the Google Groups "kamon-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kamon-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manoj Santhakumaran

unread,
May 11, 2016, 9:59:46 PM5/11/16
to kamon-user

Hi Diego,

Apologies for throwing out the post in a hurry before a deep dive.

It turned out to be my configuration issue, and I could able to resolve it now.

The reasons of my problem were;

1. I configured "aspectj" weaver JAR in my build.sbt as follows:
    bashScriptExtraDefines += """addJava "-javaagent:${lib_dir}/aspectjweaver-1.8.9.jar""""
   
    But the file name was different when I built the application bundle using universal package bin. Essentially, "-javaagnet" was pointing to a JAR which was not present in that disk location.

2. I also had Kamon akka remote dependency in my classpath:
    "io.kamon" %% "kamon-akka-remote" % "0.6.0"
   
    This classpath dependency I removed.
   
When I fixed the above two configuration, the exception got vanished.

Thanks a lot to you and the user group. I learned these from the past discussions you had in this forum.

Regards,
Manoj

Diego Parra

unread,
May 15, 2016, 4:03:38 PM5/15/16
to kamon...@googlegroups.com
Thank you for sharing Manoj.

Cheers,

Diego
Reply all
Reply to author
Forward
0 new messages