I'm trying to configure a play application to use Kamon. I've created a new play application using
activator new kamon-play play-scala
Then I posted it on github. I'm running on OS X 10.11.1 and I'm running JDK 1.8.0_65-b17 and the project is configured with scala 2.11.6. I've configured it (to the best of my understanding) based on the instructions for configuring Play as well as the sbt-aspectj-runner kamon-play example. However when I try to run the application using either:
sbt run
or
activator run
I get the following error:
[ERROR] [11/25/2015 09:04:39.574] [ForkJoinPool-1-worker-9] [ModuleLoader(akka://kamon)]
___ _ ___ _ _ ___ ___ _ _
/ _ \ | | |_ | | | | | | \/ |(_) (_)
/ /_\ \ ___ _ __ ___ ___ | |_ | | | | | | ___ __ _ __ __ ___ _ __ | . . | _ ___ ___ _ _ __ __ _
| _ |/ __|| '_ \ / _ \ / __|| __| | | | |/\| | / _ \ / _` |\ \ / // _ \| '__| | |\/| || |/ __|/ __|| || '_ \ / _` |
| | | |\__ \| |_) || __/| (__ | |_ /\__/ / \ /\ /| __/| (_| | \ V /| __/| | | | | || |\__ \\__ \| || | | || (_| |
\_| |_/|___/| .__/ \___| \___| \__|\____/ \/ \/ \___| \__,_| \_/ \___||_| \_| |_/|_||___/|___/|_||_| |_| \__, |
| | __/ |
|_| |___/
It seems like your application was not started with the -javaagent:/path-to-aspectj-weaver.jar option but Kamon detected
the following modules which require AspectJ to work properly:
kamon-akka, kamon-scala, kamon-play
If you need help on setting up the aspectj weaver go to http://kamon.io/introduction/get-started/ for more info. On the
other hand, if you are sure that you do not need or do not want to use the weaver then you can disable this error message
by changing the kamon.show-aspectj-missing-warning setting in your configuration file.
I've tried all of the following:
Adding
aspectj-play-runner:run
to the plugins.sbt file (doesn't compile)passing in the javaagent argument to activator:
activator -J-javaagent::~/.ivy2/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.5.jar
but that results in the following error:
Error opening zip file or JAR manifest missing : :~/.ivy2/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.5.jar
Error occurred during initialization of VM
agent library failed to init: instrument
passing in the javaagent argument to sbt:
sbt run -Djavaagent:~/.ivy2/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.5.jar
also tried
sbt run -Djavaagent:~/.ivy2/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.5.jar -Daspectj-play-runner:run
UPDATE
I figured out that aspectj-play-runner:run is an sbt task/command so I tried that:
sbt
aspectj-runner:run
which outputs:
[WeavingURLClassLoader] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
java.lang.RuntimeException: Kamon has not been started yet. You must either explicitlt call Kamon.start(...) or enable automatic startup by adding -Dkamon.auto-start=true to your JVM options.
So then I tried:
sbt -Dkamon.auto-start=true
aspectj-runner:run
Which outputs:
[WeavingURLClassLoader] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
com.typesafe.config.ConfigException$IO: application.conf: java.io.IOException: resource not found on classpath: application.conf
Lastly, the documents actually say I should be running
sbt
aspectj-play-runner:run
But the command/task isn't even recognized.
I was able to contact @kamonteam on twitter and this was their reply:
Based on that I removed references to the kamon-akka module from my build.sbt and application.config and now it's working. Once I have an issue # from the project I'll track it and post when the issue is resolved. In the meantime, here's the commit that "fixed" the issue for me. I still need the akka module for it to be a complete solution for me however.