线程"main"中的异常java.lang.NoSuchMethodError:com.google.common.base.Preconditions.checkState(ZLjava/lang/String; Ljava/lang/Object;) [英] Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)

查看:2429
本文介绍了线程"main"中的异常java.lang.NoSuchMethodError:com.google.common.base.Preconditions.checkState(ZLjava/lang/String; Ljava/lang/Object;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了以下硒代码:

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.edge.EdgeDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.support.ui.Select;
    import java.util.List;

    public class TestDemoQA {
        public static void main(String[] args) throws InterruptedException{
            System.setProperty("webdriver.edge.driver", "C:\\Users\\Suganthan\\Downloads\\MicrosoftWebDriver.exe");
            WebDriver driver = new EdgeDriver();
            driver.get("http://demoqa.com/");
            driver.manage().window().maximize();`

我收到的错误是:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)

我正在尝试根据此解决方案来解决此问题,方法是升级番石榴-21.0.但我仍然收到此错误.有人可以提供解决方案吗?

I'm trying to solve this issue according to This Solution by upgrading guava-21.0. But I'm still getting this error. could anyone give a solution to solve it?

推荐答案

此错误消息...

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)

...表示 JVM 无法启动/生成程序.

...implies that the JVM was unable to initiate/spawn your program.

正如@GhostCat指出的那样,您的主要问题是 guava 版本与您使用的其他二进制版本之间的不兼容性.

As @GhostCat pointed your main issue is the incompatibility between the guava version and other binary versions you are using.

  • JDK 升级到最新级别 JDK 8u181 .
  • 升级到当前级别 版本3.14.0 > .
  • 当您删除以前版本的 Selenium Client 时,请确保正确删除了所有关联的 jars .
  • 通过 IDE
  • 清理您的项目工作区重建您的项目,并且仅具有必需的依赖项.
  • 执行您的@Test.
  • Upgrade JDK to recent levels JDK 8u181.
  • Upgrade Selenium to current levels Version 3.14.0.
  • When you remove the previous version of Selenium Client ensure that all the associated jars are properly removed.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Execute your @Test.

这篇关于线程"main"中的异常java.lang.NoSuchMethodError:com.google.common.base.Preconditions.checkState(ZLjava/lang/String; Ljava/lang/Object;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆