Wednesday, January 18, 2012

JMX and Grails

Developing on windows can sometimes really be a pain. I had found documentation all over the web as to where to place my JVM arguments to make grails accept remote JMX connections while developing in eclipse. Most have you modifying $GRAILS_HOME/bin/grails.bat but I was noticing in Java Visual VM (great tool by the way) that the VM arguments were not changing.

In one of those 'the answer is simple stupid' moments - some clarity was given to me by this page of documentation: http://www.objectpartners.com/2009/05/27/eclipse-setup-for-grails-11-development/

By adding the following string the run configuration for my Grails project:

-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=<yourHostIPHere> -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
[Note this is obviously not a production setting, you will NEED AUTHENTICATION in production]

I was able to get jconsole to connect to the remote process. Of course local connections had never been a problem as JMX is enabled locally by default.

For anyone curious, the run configuration for a tutorial project is shown below.

A run configuration for JMX with Grails on Windows Eclipse.

No comments:

Post a Comment