使用 java.util.concurrent.TimeUnit 在 JMETER 上显示 GroovyBugError
Using java.util.concurrent.TimeUnit shows GroovyBugError on JMETER
我目前正在使用带有 Selenium Web Driver Sampler 插件的 JMETER。为什么会这样?我可以使用任何解决方案以便我可以使用隐式等待、显式等待和流畅等待?
这是我的代码
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(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) [?:?]
Unsupported class file major version 61
- 正在寻找here -
Java SE 17 = 61 (0x3D hex)
so you're using Java 17 which was released in September 2021
- 正在寻找here it seems that the latest JMeter 5.4.3 is using Groovy 3.0.7 which was released in December 2020
所以我的期望是您需要将 Java 版本降级到 2020 年 12 月存在的版本,即 Java 11 and the problem should go away. The minimum version you can run JMeter 5.4+ 是 Java 8.
我目前正在使用带有 Selenium Web Driver Sampler 插件的 JMETER。为什么会这样?我可以使用任何解决方案以便我可以使用隐式等待、显式等待和流畅等待?
这是我的代码
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(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) [?:?]
Unsupported class file major version 61
- 正在寻找here -
Java SE 17 = 61 (0x3D hex)
so you're using Java 17 which was released in September 2021 - 正在寻找here it seems that the latest JMeter 5.4.3 is using Groovy 3.0.7 which was released in December 2020
所以我的期望是您需要将 Java 版本降级到 2020 年 12 月存在的版本,即 Java 11 and the problem should go away. The minimum version you can run JMeter 5.4+ 是 Java 8.