JAVA: 解决报错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;)V

用到selenium webdiver的是,发现报错:

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;)V

解决方法,在maven的porm.xml的配置文件中加载最新版的google guava

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

源自:http://mvnrepository.com/artifact/com.google.guava/guava

Please tune your project settings and add guava [1] version 10+ to the classpath (selenium
distribution package includes guava 15)

[1] https://code.google.com/p/guava-libraries/

本文:JAVA: 解决报错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;)V

 

Leave a Reply