简体   繁体   中英

java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter with Selenium ChromeDriver Chrome with Java

My Chrome version is 75.0.3770.142 and i'm using ChromeDriver 75.0.3770.90 in my code with below pom dependency

   <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.5.3</version>
   </dependency>

When i try to run the test chromedriver doesn't get load. it gives below 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
    at org.openqa.selenium.net.UrlChecker.<init>(UrlChecker.java:67) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144) ~[selenium-remote-driver-2.53.1.jar:na]
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170) ~[selenium-chrome-driver-2.53.1.jar:na]
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138) ~[selenium-chrome-driver-2.53.1.jar:na]
    at com.bfwg.service.impl.TestSuiteServiceImpl.loadWebDriver(TestSuiteServiceImpl.java:120) ~[classes/:na]
    at com.bfwg.service.impl.TestSuiteServiceImpl.execute(TestSuiteServiceImpl.java:86) ~[classes/:na]
    at com.bfwg.service.impl.TestSuiteServiceImpl$$FastClassBySpringCGLIB$$517eb5f7.invoke(<generated>) ~[classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:669) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at 

Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 23065
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

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 the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=75.0
  • Your Selenium Client version is 3.5.3 of 2017-08-29T12:42:44.417Z which is almost 2 years older.
  • Your JDK version is is unknown to us.

So there is a clear mismatch between the Selenium Client v3.5.3 and ChromeDriver v2.46 .


Solution

  • Upgrade JDK to current levels JDK 8u212 .
  • Selenium is upgraded to current levels Version 3.141.59 .
  • ChromeDriver is updated to current ChromeDriver v76.0 level.
  • Chrome is updated to current Chrome Version 76.0 level. (as per ChromeDriver v76.0 release notes )
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client .
  • Execute your @Test as a non root user.

You can find a detailed analysis on com.google.common.util.concurrent.SimpleTimeLimiter in the discussion java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter. when using Selenium-Java 3.5.1 or above

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter.(Ljava/util/concurrent/ExecutorService;)V [on hold] java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter. when using Selenium-Java 3.5.1 or above com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java) with ChromeDriver and Chrome using Selenium and Java maven java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(); from WeldMessageConveyor Netbeans and Maven Project: java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap java.lang.IllegalAccessError: tried to access method java.lang.NoSuchMethodError: com.google.common.util.concurrent.SimpleTimeLimiter.create at org.openqa.selenium.remote.service.DriverService.wa Java Glassfish java.lang.IllegalAccessError: tried to access method com.sun.jna.Pointer on glassfish 3.1.2.2 java.lang.IllegalAccessError: tried to access method com.dropbox.core.DbxRequestUtil.addAuthHeader
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM