gpt4 book ai didi

java - eclipse + cucumber + selenium 获取 java.lang.ClassNotFoundException : gherkin. lexer.Encoding

转载 作者:行者123 更新时间:2023-11-30 09:04:27 27 4
gpt4 key购买 nike

我是 cucumber 的初学者,按照我发现的一些例子...似乎一切正常,只是出现以下异常:

java.lang.NoClassDefFoundError: gherkin/lexer/Encoding
at cucumber.runtime.FeatureBuilder.read(FeatureBuilder.java:154)
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:115)
at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:93)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:151)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

附上我项目的一些图片。

running the class as Junit

最佳答案

我有类似的问题,我能够通过更新最新的 gherkin.jar 文件来解决它。

理想情况下,如果您使用最新的其他 *.jar,则不应出现此问题。希望这会有所帮助。

关于java - eclipse + cucumber + selenium 获取 java.lang.ClassNotFoundException : gherkin. lexer.Encoding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25204322/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com