[WebDriver]解决报错:tried to access

2019-04-03  本文已影响0人  测试你个头

UI自动化发现报错:
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
报错截图如下:

问题出在guava 的新版本中

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>25.0-jre</version>
        </dependency>

SimpleTimeLimiter的constructor被定义为private

25.0-jre版本中

Selenium的UrlChecker会通过constructor去new一个SimpleTimeLimiter对象,因此报错了


selenium包中

降低guava版本到19.0

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>

SimpleTimeLimiter的constructor被定义为public,问题解决

19.0

最后:guava版本升级后出现这个问题,降低版本即可解决,为什么我知道要降低guava版本到19.0?

因为查到UrlChecker所在jar包依赖guava版本是:


上一篇 下一篇

猜你喜欢

热点阅读