Question

I have a simple Java Maven project and want to use the JVM agent from Jolokia to fetch JMX values. It works when I manually download the jolokia-jvm-1.1.5-agent.jar and add the absolute path to the java-arguments like -javaagent:/absolute/path/to/jolokia-jvm-1.1.5-agent.jar.

As the Jolokia Download page also lists maven dependencies (jolokia-core) I wonder if I can include this directly into my Maven build without manually downloading the JVM agent? How can I run my program with this javaagent?

Was it helpful?

Solution

You can start the Jolokia JVM agent programatically, too. The entry point is org.jolokia.jvmagent.JolokiaServer (to be found in the module jolokia-jvm). Please refer to the source, there is quite some documentation there.

Or if you are using Spring, there is even a easier solution. Simply include the Jolokia Spring config XSD and declare the agent bean in the Spring application context. More can be found in the reference manual.

Finally if you have web you could also declare the Jolokia servlet in you web.xml. See also here for the details.

When you want to automatically download the agent, you could add the Maven dependency with the classifier agent.

If you need further assitance please come to the Jolokia Forum and describe your use case there (think that is the proper place for concrete Jolokia questions).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top