Jmeter failed to start with the Prometheus JMX agent when run not from $JMETER_HOME/bin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jmeter failed to start with the Prometheus JMX agent when run not from $JMETER_HOME/bin

Lucifer13
Trying configure Prometheus JMX agent for Jmeter but faced following issue - when I start Jmeter outside of $JMETER_HOME/bin folder - it fails with an error:

java.lang.Throwable: Could not access null/lib
        at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/ext
        at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/junit
        at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.ClassNotFoundException: org.apache.jmeter.JMeter
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:250)
JMeter home directory was detected as: null

null- is because I run from / , and JMeter is set to parent dir

Launch command:

java -Dcom.sun.management.jmxremote.port=12021 -Dcom.sun.management.jmxremote.rmi.port=12021 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dgroovy.use.classvalue=true -javaagent:/apps/injector/apache-jmeter/bin/jmx_prometheus_javaagent-0.13.0.jar=8778:/apps/injector/apache-jmeter/bin/prometheus_config.yaml -jar /apps/injector/apache-jmeter/bin/ApacheJMeter.jar -n -t /apps/injector/apache-jmeter/extras/Test.jmx

Same command works fine in case I run it from $JMETER_HOME/bin folder.

Running a Jmeter with -javaagent option defined - set JMeter home directory as a parent dir for the dir I trying to run from.

JMETER_HOME env var is defined and both JMETER_HOME and JMETER_HOME/bin added to PATH. And I can run Jmeter with the above command from any path when removing -javaagent option from the original command.

Tried also -d/--homedir Jmeter options - but this didn't help.

How can I make Jmeter to be compatible with Prometheus agent and to be run from any path?
Reply | Threaded
Open this post in threaded view
|

Re: Jmeter failed to start with the Prometheus JMX agent when run not from $JMETER_HOME/bin

Lucifer13
solved with:
-Djmeter.home=$JMETER_HOME