3

I am able to run the jmeter in GUI mode by using command like "jmeter -t my-test.jmx". However, when I add the "-n" (NON-GUI mode) using "jmeter -n -t my-test.jmx", I am getting the following error. I am running it on Mac Big Sur, updated to most recent jmeter 5.4.3 (was 5.4.1, both releases have the same error). Also, my java version is "AdoptOpenJDK (build 11.0.10+9)". What could have been the problem?

Created the tree successfully using my-test.jmx
Starting standalone test @ Thu Jan 13 16:19:42 EST 2022 (1642108782890)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
Uncaught Exception BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' Unsupported class file major version 61 in thread Thread[echoDom (jaxp-serializer) Thread Group 1-1,5,main]. See log file for details.
Uncaught Exception BUG! exception in phase 'semantic analysis' in source unit 'Script2.groovy' Unsupported class file major version 61 in thread Thread[echoDom (jaxp-serializer) Thread Group 1-3,5,main]. See log file for details.
Uncaught Exception BUG! exception in phase 'semantic analysis' in source unit 'Script3.groovy' Unsupported class file major version 61 in thread Thread[echoDom (jaxp-serializer) Thread Group 1-2,5,main]. See log file for details.
...
summary =      0 in 00:00:00 = ******/s Avg:     0 Min: 9223372036854775807 Max: -9223372036854775808 Err:     0 (0.00%)
Tidying up ...    @ Thu Jan 13 16:20:34 EST 2022 (1642108834650)
... end of run
Wally Liu
  • 85
  • 7

2 Answers2

3

I just stumbled upon the solution. I changed the file "/usr/local/Cellar/jmeter/5.4.3/bin/jmeter". It used to have "JAVA_HOME="/usr/local/opt/openjdk"" inside, which is pointing to a java 17 installation. I replaced the JAVA_HOME with a java 11 location "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home". Problem solved.

Wally Liu
  • 85
  • 7
0

As per the General Layout table of the Java class file wikipedia article

Java SE 17 = 61 (0x3D hex),

so I think your AdoptOpenJDK (build 11.0.10+9) is wrong, take a look at jmeter.log file, it reports which Java version JMeter is using and my expectation is that you will see Java 17 there.

So you need to point JMeter to use earlier Java version, JMeter 5.4+ is designed to work with JDK 8

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri. You are correct that it appears the jmeter is using "java.version=17.0.1" in the log. However, when I switched default java to "1.8.0_282", jmeter.log is still showing the 17.0.1 being used. I did uninstall and reinstall jmeter (made sure my default jdk is 11 or 8 before I did that). Somehow the 17.0.1 is still used by jmeter. Anyway to change it to use my default $JAVA_HOME? Another puzzling thing is the error only happened in non-gui mode - GUI started up fine although it's also under java 17.0.1 in the log. – Wally Liu Jan 14 '22 at 15:02
  • Btw, I don't even have java 17 installed locally. Did jmeter install itself then use it regardless which my local java setting is? – Wally Liu Jan 14 '22 at 15:10
  • You do, the question is where. I don't know what your "local java setting" is, JMeter picks up whatever it finds first in the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)). So if you do something like `PATH=/path/to/your/java8/bin:$PATH && export PATH` and then launch JMeter from the same terminal window - it will use Java 8. More information: [Get Started With JMeter: Installation & Tests](https://www.blazemeter.com/blog/how-get-started-jmeter-installation-test-plans). You may also find [SDKMAN project](https://sdkman.io/) useful – Dmitri T Jan 14 '22 at 19:57
  • Thanks. As you can see, I managed to get it to work. It had something to do with a jmeter launch script somehow was changed so JAVA_HOME pointed to a java 17 installation that I wasn't aware existing. – Wally Liu Jan 15 '22 at 15:29