Search code examples
javajmeterperformance-testing

Jmeter linux shell cannot start server


Situation:

I have installed Jasper Reports Library (V6.5.1) on my local Linux server which generates PDF reports (Data is dumped in a temp Oracle DB table for the reporting engine).

It then serves this PDF back to the website from which I kick off the process.

Goal:

Install Jmeter to analyse performance / possible bottlenecks of "Jasper Reports Library" (aka Report Generation) on my local linux server (I cannot access this server via GUI, only shell).

I understand I have to connect my local Windows 10 machine (running same Jmeter 4.0) with this local server. On the server I have to start Jmeter 4.0 Server (via jmeter-server command) however I get an error and am stuck (have not found anything online or even people with the same goal unfortunately...)

Steps I have taken:

  • Download latest (4.0) bin from here
  • Extracted on local linux server in /opt/dlins/apache-jmeter-4.0bin
  • Trying to start server with /usr/lib/jvm/jdk1.8.0_102/bin/java jmeter-server (the default java version is 6 so through this I can run this app with java 8) - Instructions found here

-> Getting error: "Error: Could not find or load main class jmeter-server" enter image description here

Any help regarding above or even any other tool you may use are appreciated (Maybe there is a preferable way to test performance for the above scenario)


Solution

  • There are 2 aspects related to your issue and screenshot:

    1) Using java 8 instead of 6 - This can be done in several ways, depending on your needs and restrictions, such as the need to have Java 6 globally available for other applications and using 8 just to run JMeter, or just replacing 6 with 8 entirely. For the sake of brevity, I'll assume the first scenario, but there's documentation available for both and Dmitri T has partially explained it already.

    Anyway, the same JMeter doc link you used, describes (just scroll down a few times) how to create a setenv.sh script in the bin directory and configure JAVA_HOME or JRE_HOME depending on your needs.

    To set those variables permanently, you can place them in a file called setenv.sh in the bin directory. This file will be sourced when running JMeter by calling the jmeter script.

    You seem to be wanting a JDK, so create the script and add inside JAVA_HOME=/usr/lib/jvm/jdk1.8.0_102, save and exit.

    2) Running JMeter - To clarify a minor confusion, java MyCompiledClass instructs java to load and execute the "program" defined in MyCompiledClass, which is not what you want to do, because jmeter-server is a shell script. If you open it, you'll see that it calls the jmeter shell script which will do some configuration, end eventually call (in short) java -jar ApacheJMeter.jar with some arguments and options.

    So, to run JMeter make sure your scripts are executable with chmod, and simply run from command line ./jmeter-server. From the same link:

    Un*x script files; should work on most Linux/Unix systems:

    jmeter - run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.

    jmeter-server - start JMeter in server mode (calls jmeter script with appropriate parameters)

    jmeter.sh - very basic JMeter script (You may need to adapt JVM options like memory settings).

    mirror-server.sh - runs the JMeter Mirror Server in non-GUI mode

    shutdown.sh - Run the Shutdown client to stop a non-GUI instance gracefully

    stoptest.sh - Run the Shutdown client to stop a non-GUI instance abruptly