【软件测试】Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet

异常

Exception:
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
    at org.openqa.selenium.remote.ProtocolHandshake.streamW3CProtocolParameters(ProtocolHandshake.java:284)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:149)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
    at setup.Setup.setUp(Setup.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
    at org.testng.TestRunner.privateRun(TestRunner.java:744)
    at org.testng.TestRunner.run(TestRunner.java:602)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
    at org.testng.TestNG.runSuites(TestNG.java:1144)
    at org.testng.TestNG.run(TestNG.java:1115)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
    Suppressed: java.io.IOException: Incomplete document
        at com.google.gson.stream.JsonWriter.close(JsonWriter.java:544)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:167)
        ... 35 more

解决方法

Launching Chrome Browser through Appium on Windows
pom.xml添加一下dependency:

<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>21.0</version>
</dependency>
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
根据提供的引用内容,这个错误通常是由于Kafka版本与使用的其他库版本不兼容导致的。可能的解决方法是升级或降级Kafka版本,以使其与其他库版本兼容。 以下是一些可能有用的步骤: 1.检查Kafka版本是否与使用的其他库版本兼容。 2.尝试升级或降级Kafka版本,以使其与其他库版本兼容。 3.检查是否存在其他库版本冲突的情况,可能需要升级或降级其他库版本。 4.检查是否正确设置了CLASSPATH环境变量,以便Kafka可以找到所需的类。 5.检查是否正确设置了JAVA_HOME环境变量,以便Kafka可以找到正确的Java安装路径。 6.检查是否正确设置了KAFKA_HOME环境变量,以便Kafka可以找到正确的安装路径。 ```java // 示例代码 // 引用[1] // 检查Kafka版本是否与使用的其他库版本兼容 // 尝试升级或降级Kafka版本,以使其与其他库版本兼容 // 检查是否存在其他库版本冲突的情况,可能需要升级或降级其他库版本 // 检查是否正确设置了CLASSPATH环境变量,以便Kafka可以找到所需的类 // 检查是否正确设置了JAVA_HOME环境变量,以便Kafka可以找到正确的Java安装路径 // 检查是否正确设置了KAFKA_HOME环境变量,以便Kafka可以找到正确的安装路径 // 引用[2] // java.io.NotSerializableException: org.apache.log4j.Logger // 这个错误通常是由于Logger类没有实现Serializable接口导致的。 // 可以尝试使用transient关键字修饰Logger对象,或者使用其他可序列化的日志库。 ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值