'java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter error using Maven

When running my scripts, I get the following error:

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

Below is my 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>

I have tried updated the chromedriver and the serenity dependencies but that did not resolve the issue. Can anyone help me figure a solution for this?



Solution 1:[1]

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

Solution 2:[2]

This error message...

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

...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:

  • Chrome is upgraded to Chrome Version 100.0.4896.88
  • ChromeDriver is updated to ChromeDriver v100.0 level.

References

You can find a couple of relevant detailed discussions in:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amit Kumar
Solution 2 undetected Selenium