java.lang.illegalaccesserror:尝试访问方法com.google.common.util.concurrent.simpletimelimiter使用maven
运行脚本时,我会收到以下错误:
java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter.<init>(Ljava/util/concurrent/ExecutorService;)V from class org.openqa.selenium.net.UrlChecker
以下是我的pom.xml,
<properties>
<entry_point>**/*Suite.java</entry_point>
<serenity.version>1.1.39</serenity.version>
<serenity.jbehave.version>1.9.0</serenity.jbehave.version>
<webdriver.driver>chrome</webdriver.driver>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-rest-assured</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-jbehave</artifactId>
<version>${serenity.jbehave.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-util</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<configuration>
<includes>
<include>${entry_point}</include>
</includes>
<runOrder>alphabetical</runOrder>
<systemPropertyVariables>
<metafilter>-productionOnly</metafilter>
<chrome.switches>--no-sandbox,--disable-extensions</chrome.switches>
<webdriver.driver>${webdriver.driver}</webdriver.driver>
<serenity.data.dir>..</serenity.data.dir>
<serenity.step.delay>0</serenity.step.delay>
<serenity.take.screenshots>FOR_FAILURES</serenity.take.screenshots>
<serenity.driver.capabilities>
unexpectedAlertBehaviour:ignore;ie.ensureCleanSession=true;
</serenity.driver.capabilities>
<story.timeout.in.secs>1800</story.timeout.in.secs>
<use.test.case.for.story.tag>false</use.test.case.for.story.tag>
<untrusted.certificates>false</untrusted.certificates>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
我尝试过更新Chromedriver和Serenity依赖性,但这并不能解决问题。谁能帮助我为此找到解决方案?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误表明您正在使用的WebDriver变体(即Geckodriver / Chromedriver)的版本之间存在不匹配。
确保您使用的是最新的JDK版本,如果没有,请更新您的JDK,然后重试。这可能会有所帮助。
The error indicated that there was a mismatch between the version of the WebDriver variant (i.e. GeckoDriver / ChromeDriver) and the version of the respective WebBrowser variant (i.e. Firefox / Chrome) you are using.
Make Sure you are using latest JDK version, if not then update your JDK and try again. That may help.
https://www.oracle.com/technetwork/java/javase/downloads/index.html
此错误消息...
...意味着您正在使用的二进制文件之间存在一些不兼容。
解决方案
确保将 jdk 升级到当前级别 JDK 8U311 。
INCASE您正在使用 Chromedriver / Chrome 组合,请确保:
参考文献
您可以在: java.lang.illang.illegalaccesserror中找到一些相关的详细讨论
This error message...
...implies that there are some incompatibility between the version of the binaries you are using.
Solution
Ensure that JDK is upgraded to current levels JDK 8u311.
Incase you are using ChromeDriver / Chrome combo, ensure that:
References
You can find a couple of relevant detailed discussions in: