Home > front end >  Using java.util.concurrent.TimeUnit shows GroovyBugError on JMETER
Using java.util.concurrent.TimeUnit shows GroovyBugError on JMETER

Time:03-23

I am currently using JMETER with plugin for Selenium Web Driver Sampler. Why is this happening? any solution I can use so that I can use implicit wait, explicit wait, and fluent wait?

Here is my code

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.time.*;
WDS.sampleResult.sampleStart()
WDS.browser.get('[mywebsite]')
WebDriver driver = WDS.browser;
WebDriverWait wait = new WebDriverWait(driver,30)
Actions builder = new Actions(driver);


var timeunit = java.util.concurrent.TimeUnit;

ERROR encountered
2022-03-22 06:04:08,501 ERROR o.a.j.JMeter: Uncaught exception in thread Thread[Thread Group 1-1,6,main]
org.codehaus.groovy.GroovyBugError: BUG! exception in phase 'semantic analysis' in source unit 'Script69.groovy' Unsupported class file major version 61
    at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:905) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627) ~[groovy-3.0.7.jar:3.0.7]
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389) ~[groovy-3.0.7.jar:3.0.7]
    at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154) ~[groovy-3.0.7.jar:3.0.7]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330) ~[groovy-3.0.7.jar:3.0.7]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314) ~[groovy-3.0.7.jar:3.0.7]
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:257) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:336) ~[groovy-jsr223-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153) ~[groovy-jsr223-3.0.7.jar:3.0.7]
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262) ~[java.scripting:?]
    at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:86) ~[jmeter-plugins-webdriver-3.3.jar:?]
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) ~[ApacheJMeter_core.jar:5.4.3]
    at java.lang.Thread.run(Thread.java:833) [?:?]

CodePudding user response:

Unsupported class file major version 61

  1. Looking here - Java SE 17 = 61 (0x3D hex) so you're using Java 17 which was released in September 2021
  2. Looking here it seems that the latest JMeter 5.4.3 is using Groovy 3.0.7 which was released in December 2020

So my expectation is that you need to downgrade your Java version to something which existed in December 2020 i.e. to Java 11 and the problem should go away. The minimum version you can run JMeter 5.4 is Java 8.

CodePudding user response:

You can download JMeter 5.5 which supports Java 17 (major version 61)

JMeter now supports Java 17

There's only a RC version , but soon will be release officially

  • Related