Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()

I keep getting the above error (full text below) with guava-23.6-jre.jar I'm doing everything with IntelliJ IDEA so I don't have pom.xml anywhere in my project. My code does nothing special, the line 39 is the setProperty() call:

    @Before
    public void Setup(){
        System.setProperty("webdriver.chrome.driver", "/Users/xxxxx/Documents/Java/end2endtests/chromedriver");
        _driver = new ChromeDriver();
        _helper = new WebDriverHelper(_driver);
        _wait = new WebDriverWait(_driver, Constants.SPIN_WAIT_TIMEOUT);
}

The error is

java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;

at org.openqa.selenium.chrome.ChromeOptions.asMap(ChromeOptions.java:306)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:107)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at PlaylistTest.Setup(PlaylistTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

and here is the list of the packages I have installed:

animal-sniffer-annotations-1.14.jar jackson-databind-2.8.9.jar
bcpkix-jdk15on-1.58.jar         jcl-over-slf4j-1.7.25.jar
bcprov-jdk15on-1.58.jar         jsr305-1.3.9.jar
browsermob-core-2.1.5.jar       junit-4.12.jar
byte-buddy-1.7.9.jar            jzlib-1.1.3.jar
checker-compat-qual-2.0.0.jar       littleproxy-1.1.0-beta-bmp-17.jar
commons-codec-1.10.jar          mitm-2.1.5.jar
commons-exec-1.3.jar            netty-all-4.0.51.Final.jar
commons-lang3-3.5.jar           okhttp-3.9.1.jar
commons-logging-1.2.jar         okio-1.13.0.jar
dnsjava-2.1.8.jar           selenium-api-3.9.1.jar
error_prone_annotations-2.0.18.jar  selenium-chrome-driver-3.9.1.jar
error_prone_annotations-2.1.3.jar   selenium-edge-driver-3.9.1.jar
gson-2.8.2.jar              selenium-firefox-driver-3.9.1.jar
guava-23.0-android.jar          selenium-ie-driver-3.9.1.jar
guava-23.6-jre.jar          selenium-java-3.9.1.jar
hamcrest-core-1.3.jar           selenium-opera-driver-3.9.1.jar
httpclient-4.5.3.jar            selenium-remote-driver-3.9.1.jar
httpcore-4.4.6.jar          selenium-safari-driver-3.9.1.jar
j2objc-annotations-1.1.jar      selenium-server-standalone-3.9.1.jar
jackson-annotations-2.8.9.jar       selenium-support-3.9.1.jar
jackson-core-2.8.9.jar          slf4j-api-1.7.25.jar
like image 411
Nick Slavsky Avatar asked Feb 21 '18 19:02

Nick Slavsky


2 Answers

I faced the same issue as my testng version updated to 7.3 from 7.1, while selenium was on 3.141.59.

Reverting testng version or updating selenium should resolve the issue

like image 121
Kunjal Gandhi Avatar answered Oct 20 '22 22:10

Kunjal Gandhi


I faced the same issue as my testng version updated to 7.3 from 7.0.0, while selenium was on 3.141.59. "Project was Maven" and Issue resolved ( chrome browser was launched )

like image 36
user16041877 Avatar answered Oct 20 '22 22:10

user16041877