Instrumenation in OGGi container KARAF

323 Views Asked by At

I am trying to print the memory usage of an collection through java instrumentation api. Gone through the instrumentation api's in java. Can anyone please tell me how to configure it in KARAF container.

Tried by adding the below entry in classpath KARAF_JVM_OPTS="$KARAF_JVM_OPTS -javaagent:/var/tmp/java-agent-1.0.0.jar" Also added in properties file org.osgi.framework.bootdelegation=com.test.java.javaagent.*

1

There are 1 best solutions below

0
Ramesh Subramanian On

Adding JAVA_OPTIONS to Karaf depends on how you start Karaf.

Basically, you have 3 ways:

  1. Using bin/karaf, you can directly modify the karaf script, or use the setenv script (and provide the JAVA_OPTS variable).
  2. Using bin/start, it's basically the same as 1.
  3. Using service wrapper, you have to modify the etc/karaf-wrapper.conf file.

Note : You have to add the argument -javaagent:<<PATH_OF_YOUR_JAR>> only on the JAVA_OPTIONS , not on the classpath.