Jmeter在非$JMETER_HOME/bin目录下运行时,使用Prometheus JMX代理启动失败。

huangapple go评论83阅读模式
英文:

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

问题

尝试配置Prometheus JMX代理以用于Jmeter,但遇到以下问题 - 当我在**$JMETER_HOME/bin**文件夹之外启动Jmeter时 - 它会因错误而失败:

java.lang.Throwable: 无法访问 null/lib
            at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: 无法访问 null/lib/ext
            at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: 无法访问 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的主目录被检测为null

启动命令:

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

相同的命令在我从**$JMETER_HOME/bin文件夹运行时正常工作。这似乎不是Jmeter本身的问题,因为我可以从任何地方运行相同的命令,并且如果我删除-javaagent**选项,它不会导致错误。

有人可以帮助我正确配置Prometheus JMX代理以使其与Jmeter正常工作吗?

英文:

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.&lt;clinit&gt;(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/ext
        at org.apache.jmeter.NewDriver.&lt;clinit&gt;(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/junit
        at org.apache.jmeter.NewDriver.&lt;clinit&gt;(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

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.
It's not seems to be a Jmeter issue itself, as I can run same command from any place, and it will not cause an error in case I remove -javaagent option.

Can somebody help me configure Prometheus JMX agent for properly work with Jmeter.

答案1

得分: 1

将以下内容添加到JMeter的Java选项中:

-Djmeter.home=$JMETER_HOME

根据您的Bugzilla工单:

感谢JMeter团队成员Felix S.提供。

英文:

Add to java options of JMeter:

> -Djmeter.home=$JMETER_HOME

As per your bugzilla ticket:

Credit to Felix S. member of JMeter team

huangapple
  • 本文由 发表于 2020年8月19日 14:18:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/63481033.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定