Java Play 2.2 does not support javaagent

With the previous version of the Java Play platform, we could provide a command line server for loading monitoring agents. For example, NewRelic can be loaded as

./path/to/start -javaagent:/path/to/newrelic.jar 

With the release of version 2.2, the Play team has significantly changed the start of the script. From what I can say, it no longer supports javaagents. Has anyone else got NewRelic working with Java Play 2.2+? The game is great, but its useless technology, if you can not control it in a production environment ...

+7
playframework newrelic
source share
4 answers

It seems you can prefix Java variants with -J (similar to system properties with -D ):

 $ bin/<app> -J-javaagent:lib/newrelic.jar 

This is detected when you look in the script, but the usage summary states:

 $ bin/<app> -h Usage: [options] ... -JX pass option -X directly to the java runtime (-J is stripped) ... 
+12
source share

With the new native packer in Play Framework 2.2, you need to set Java parameters in the JAVA_OPTS environment JAVA_OPTS .

+1
source share

In Play Framework version 2.2, the launch of the script application has changed to a different directory. To download the javaagent library, you must specify the full path.

For example, if heroku-javaagent-1.4.jar is in the lib directory:

 heroku config:set JAVA_OPTS="-Xmx384m -Xss512k -XX:+UseCompressedOops -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCDateStamps -javaagent:/app/lib/heroku-javaagent-1.4.jar=stdout=true,lxmem=true" 
0
source share

This works for PlayFramework 2.3.x. I copied the jar + yml agent configuration file to PLAY_APP_ROOT / lib

 sbt start -J-javaagent:lib/newrelic.jar 
0
source share

All Articles