Getting "Uncaught Exception BUG! exception in phase 'semantic analysis'" errors when jmeter runs in NON-GUI mode

Viewed 555

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
2 Answers

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.

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

Related