I am new to Kamon. Want to deploy Kamon for our Play 2.5.10 Java application in Test and Production environment.
Config:
Java - 1.8
Play - 2.5.x
SBT - 0.13.11
Scala - 2.11.7
I followed example at https://github.com/kamon-io/kamon-play/tree/master/kamon-examples/kamon-play-example-2.5.x
I created a new play project with play-java template.
Added following to default plugin.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.10")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
addSbtPlugin("io.kamon" % "aspectj-play-runner" % "0.1.4")
build.sbt:
name := """kamon-play-example-2.5.x"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)
val kamonVersion = "0.6.6"
libraryDependencies ++= Seq(
"io.kamon" %% "kamon-play-2.5" % kamonVersion,
"io.kamon" %% "kamon-system-metrics" % kamonVersion,
"io.kamon" %% "kamon-statsd" % kamonVersion,
"io.kamon" %% "kamon-log-reporter" % kamonVersion,
"org.aspectj" % "aspectjweaver" % "1.8.9"
)
Added following to application.conf:
kamon {
metric {
tick-interval = 1 second
}
play {
include-trace-token-header = true
trace-token-header-name = "X-Trace-Token"
}
modules {
kamon-statsd.auto-start = yes
kamon-log-reporter.auto-start = no
}
}
I have excluded statsd configuration as I want to test the kamon integration first.
The project compiles without any error.
Tried following to run in development mode:
activator -J-javaagent:aspectjweaver-1.8.5.jar run
I got AspectJViewer Missing message and
[StatsDExtension(akka://kamon)] Starting the Kamon(StatsD) extension
[ForkJoinPool-1-worker-1] [SystemMetricsExtension(akka://kamon)] Starting the Kamon(SystemMetrics) extension
[info] application - ApplicationTimer demo: Starting application at 2017-11-24T12:59:53.204Z
[info] play.api.Play - Application started (Dev)
The application starts inspite of aspectjviewer missing warning.
Is this correct?
Regards,
Suraj
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Now I want to move Kamon integration to our UAT and Prod environment.
We run Play app in Production mode on our UAT and Prod i.e. stage and then we run the app.sh
For aspectJViewer, it is not clear from documentation how to execute it in Production mode.
I tried as per docs:
java -cp ".:lib/*" -javaagent:lib/aspectjweaver-1.8.7.jar play.core.server.ProdServerStart
Got message "Error opening zip file or JAR manifest missing : lib/aspectjweaver-1.8.9.jar"
JAR file is missing in my target/universal/stage/lib folder.
Any idea what's going wrong here?
Regards,
Suraj
Regards,
Suraj
Now, I gave absolute path for aspectjviewer and got different issue:
F:\Installations\workspace\play\kamon-play-example-2.5.x\target\universal\stage\bin>java -cp ".:lib/*" -javaagent:C:\Users\Suraj\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.8.10.jar play.core.server.ProdServerStart
Error: Could not find or load main class play.core.server.ProdServerStart
Seems like play core jar is not found on path.
Then I tried this and got other error:
F:\Installations\workspace\play\kamon-play-example-2.5.x\target\universal\stage\bin>java -cp "C:\Users\Suraj\.ivy2\cache\com.typesafe.play\play-server_2.11\jars\*" -javaagent:C:\Users\Suraj\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.8.10.jar play.core.server.ProdServerStart
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: play/core/server/ServerWithStop
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: play.core.server.ServerWithStop
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
It needs more jars on path. What set of JARs I should provide while running the app? And why are these JARs needed? I don;t need to do this when I run the app without aspectjviewer?
Regards,
Suraj
Any help on this? Not able to move forward.
Suraj