My environment
- Developer PC: Windows 8, VisualVM in JDK1.6
- Server: Ubuntu, JDK1.6, play 1.2.2
For connecting to local Play app, the only option "-Dcom.sun.management.jmxremote" is OK.
But for connecting to remote Play app, more options are needed for JVM.
Since set _JAVA_OPTIONS environment will affect all Java programs, I changed play starting script: framework/pym/play/application.py
def java_cmd(self, java_args, cp_args=None, className='play.server.Server', args = None):
...
java_args.append('-Dcom.sun.management.jmxremote')
java_args.append('-Dcom.sun.management.jmxremote.port=5678')
java_args.append('-Dcom.sun.management.jmxremote.ssl=false')
java_args.append('-Dcom.sun.management.jmxremote.authenticate=false')
java_args.append('-Dcom.sun.management.jmxremote.local.only=false')
java_args.append('-Djava.rmi.server.hostname=192.168.0.10')
java_cmd = [self.java_path(), '-javaagent:%s' % self.agent_path()] + java_args + ['-classpath', cp_args, '-Dapplication.path=%s' % self.path, '-Dplay.id=%s' % self.play_env["id"], className] + args
return java_cmd
Then restart Play app, and reconnect it from VisualVM.