0

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?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

0

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

Amit Kumar
  • 16
  • 3
  • My chromedriver version is 100.0.4896.60 and the browser version is 100.0.4896.75 and JDK version is 1.8.0_251. I know it's not the latest but there other testers on my project with the same JDK version and they are not having any issues at all. – automation_tester Apr 13 '22 at 16:13
  • But your pom.xml tells the compiler to use language level 7 - could that be a problem? (source and target both set to `1.7`) – cyberbrain Apr 13 '22 at 19:47
  • @cyberbrain so I changed it to 1.8 to see if that would fix it and it threw a compilation error – automation_tester Apr 13 '22 at 20:22
  • _compilation_ error? Thats super strange - I could imagine a runtime error but not compilation. Can you give more details about it? – cyberbrain Apr 13 '22 at 20:29
0

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:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352