jmxjolokia

Auto attach Jolokia on application restart


I have been trying to attach Jolokia dynamically using the following command:

java -jar jolokia-jvm-1.3.4-agent.jar start <myapplication_regex>

This works successfully. But on application restart, Jolokia terminates.

Is there any workaround for handling the application restart case?


Solution

  • Try to add -javaagent:/path/to/jolokia-jvm-<version>-agent.jar to the application properties so that it gets attached on restart.