Search code examples
playframeworknewrelicplayframework-2.2

Java Play 2.2 doesn't support javaagent


With previous version of the Java Play framework, we could provide a command line argent to load monitoring agents. For example, NewRelic could be loaded as

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

With the release of the 2.2, the Play team has significantly changed the start script. From what I can tell, it no longer supports javaagents. Has any else gotten NewRelic running with Java Play 2.2+? Play is great, but its useless tech if you can't monitor it in a production environment...


Solution

  • It seems that you can prefix Java options with -J (in a manner similar to system properties using -D):

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

    Discovered this while poking around in the script itself but it is noted in the usage summary:

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