You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2020/08/20 05:34:10 UTC

[Bug 64680] New: Jmeter failed to start with the Prometheus JMX agent when run not from $JMETER_HOME/bin

https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

            Bug ID: 64680
           Summary: Jmeter failed to start with the Prometheus JMX agent
                    when run not from $JMETER_HOME/bin
           Product: JMeter
           Version: 5.1.1
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: sergiy.iampol@playtech.com
  Target Milestone: JMETER_5.3.1

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?

p.s. tried on both Linux/Win.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om

--- Comment #11 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to sergiy.iampol from comment #10)
> -Djmeter.home - works for me. Thanks a lot!!
> 
> Will try next build/nightly next week

Hello,
Did you have a chance to try nightly build ? 
https://ci.apache.org/projects/jmeter/nightlies/
Thank you for your feedback.
Regards

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #2 from sergiy.iampol@playtech.com ---
>>jmeter -n -t my_test.jmx -l log.jtl

jmeter here is a bat/sh script that set all parameters and start Jmeter itself.
But finally it just call the command I wrote.

Originally it's smth like that:
"$JAVA_HOME/bin/java" $ARGS $JVM_ARGS $JMETER_OPTS -jar
"$PRGDIR/ApacheJMeter.jar" "$@"

So your command would be translated into:
"$JAVA_HOME/bin/java" $ARGS $JVM_ARGS $JMETER_OPTS -jar
"$PRGDIR/ApacheJMeter.jar" "-n -t my_test.jmx -l log.jtl"

We used jmeter.sh (adjusted to our needs). And I got the original error
launching it with the jmeter.sh script.

I've specified real java command with all options just for better understanding
of what java options were used

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #4 from sergiy.iampol@playtech.com ---
As I said - it does work without -javaagent option. So the JMETER_HOME defined
properly and jmeter.sh can be started from anywhere.
But when I add this option (-javaagent) jmeter home dir is set somehow to the
parent (for the current dir) folder. That's why it does work from
JMETER_HOME/bin and doesn't work from anywhere else.

As for bin - yes, it's in the JMETER_HOME
JDK - HotSpot 1.8.0.221(121)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #14 from Felix Schumacher <fe...@internetallee.de> ---
There was another fall-back in place, which took preference over JMETER_HOME.
That fall-back came into life, when you switched from the root directory to
some other directory :) I only tested your exact description. My fault.

Could you please test again?

commit fd8b99411eb442df44cd0d779e0c7505c5a6adc1
AuthorDate: Fri Aug 28 09:46:53 2020 +0200

    Fall back to JMETER_HOME on startup (even more fall-back)

    Use JMETER_HOME as a fall back even before trying user.dir.

    Relates to 20ba58d0c0273d1857a3c1b614d32617faf7f7ce
    Bugzilla Id: 64680
---
 src/launcher/src/main/java/org/apache/jmeter/NewDriver.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #5 from sergiy.iampol@playtech.com ---
As I said - it does work without -javaagent option. So the JMETER_HOME defined
properly and jmeter.sh can be started from anywhere.
But when I add this option (-javaagent) jmeter home dir is set somehow to the
parent (for the current dir) folder. That's why it does work from
JMETER_HOME/bin and doesn't work from anywhere else.

As for bin - yes, it's in the JMETER_HOME
JDK - HotSpot 1.8.0.221(121)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #10 from sergiy.iampol@playtech.com ---
-Djmeter.home - works for me. Thanks a lot!!

Will try next build/nightly next week

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #1 from Sunny Agrawal <su...@gmail.com> ---
I guess the command used for starting the test is not right. We need to follow
below commands to run the jmx. i see your command has a unwanted extension
'-jar ApacheJmeter.jar'

jmeter -n -t my_test.jmx -l log.jtl

Reference:- https://jmeter.apache.org/usermanual/get-started.html

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #12 from sergiy.iampol@playtech.com ---
Created attachment 37410
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37410&action=edit
check on night buid

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Linux                       |All
           Hardware|PC                          |All
           Keywords|                            |FixedInTrunk
           Severity|major                       |normal

--- Comment #8 from Felix Schumacher <fe...@internetallee.de> ---
I added a fallback, to use JMETER_HOME, if the other detection mechanisms
failed. 

Could you test the next build/nightly?

commit 20ba58d0c0273d1857a3c1b614d32617faf7f7ce
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Aug 21 17:41:58 2020 +0200

    Fall back to JMETER_HOME on startup to detect JMeter's installation
directory

    Bugzilla Id: 64680
---
 src/launcher/src/main/java/org/apache/jmeter/NewDriver.java | 3 +++
 xdocs/changes.xml                                           | 1 +
 2 files changed, 4 insertions(+)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #3 from Felix Schumacher <fe...@internetallee.de> ---
If you set the env variable JMETER_HOME and use $JMETER_HOME/bin/jmeter to
start JMeter, the shell script should do no further processing to guess
JMETER_HOME.

Can you try to be more specific on your setup? Where is your installation of
JMeter? Is the bin folder still in JMETER_HOME? Which JDK do you use?

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Linux                       |All
           Hardware|PC                          |All
           Keywords|                            |FixedInTrunk
           Severity|major                       |normal

--- Comment #8 from Felix Schumacher <fe...@internetallee.de> ---
I added a fallback, to use JMETER_HOME, if the other detection mechanisms
failed. 

Could you test the next build/nightly?

commit 20ba58d0c0273d1857a3c1b614d32617faf7f7ce
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Aug 21 17:41:58 2020 +0200

    Fall back to JMETER_HOME on startup to detect JMeter's installation
directory

    Bugzilla Id: 64680
---
 src/launcher/src/main/java/org/apache/jmeter/NewDriver.java | 3 +++
 xdocs/changes.xml                                           | 1 +
 2 files changed, 4 insertions(+)

--- Comment #9 from Felix Schumacher <fe...@internetallee.de> ---
I added a fallback, to use JMETER_HOME, if the other detection mechanisms
failed. 

Could you test the next build/nightly?

commit 20ba58d0c0273d1857a3c1b614d32617faf7f7ce
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Aug 21 17:41:58 2020 +0200

    Fall back to JMETER_HOME on startup to detect JMeter's installation
directory

    Bugzilla Id: 64680
---
 src/launcher/src/main/java/org/apache/jmeter/NewDriver.java | 3 +++
 xdocs/changes.xml                                           | 1 +
 2 files changed, 4 insertions(+)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #6 from Felix Schumacher <fe...@internetallee.de> ---
You could try Java 11 (at least in my local setup it worked).

Can reproduce the error message with Java 8 and will look into it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #13 from sergiy.iampol@playtech.com ---
Trier on LATEST (r1830-b2d487c6fb3d9ba31b651e1e0c8a1eac05478f5d). Same problem
exists.
JMETER_HOME is set but once I run with prometheus agent - it treated as parent
dir for the dir I'm running from.
See attachment

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

sergiy.iampol@playtech.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #15 from sergiy.iampol@playtech.com ---
works with r1831-fd8b99411eb442df44cd0d779e0c7505c5a6adc1

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680

--- Comment #7 from Felix Schumacher <fe...@internetallee.de> ---
Another workaround is to add -Djmeter.home=$JMETER_HOME to your command line
options.

The problem is, that the addition of the javaagent will add another entry to
the classpath on startup. JMeter specifically looks for a classpath with one
entry, only (there is an exception for macos, though). If the classpath on
startup has more entries, it will look fot the system property jmeter.home.

-- 
You are receiving this mail because:
You are the assignee for the bug.