question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: Regression in selenium 4.1.2 with NoSuchMethodError on ImmutableMap.of

See original GitHub issue

What happened?

Upon updating from Selenium 4.1.1 to 4.1.2 I got this stacktrace with

java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap.of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'
	at org.openqa.selenium.chrome.AddHasCasting.getAdditionalCommands(AddHasCasting.java:38)

Reverting back to 4.1.1 fixes the issue. ImmutableMap.of() can only take 5 arguments, here it asks for 10. (EDIT: of can take 10 args, but AddHasCasting.java ask for 12)

Someone else also noticed the same thing, see https://stackoverflow.com/a/70969932/13365 (last part)

How can we reproduce the issue?

This is a huge project, so I haven't got a snippet yet.

Relevant log output

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [no.example.config.ModuleTestConfig$$EnhancerBySpringCGLIB$$9a335649]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap.of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'
	at app//org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224)
	at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
	at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326)
	... 101 more
Caused by: java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap.of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'
	at org.openqa.selenium.chrome.AddHasCasting.getAdditionalCommands(AddHasCasting.java:38)
	at org.openqa.selenium.chrome.ChromeDriver$ChromeDriverCommandExecutor.getExtraCommands(ChromeDriver.java:123)
	at org.openqa.selenium.chrome.ChromeDriver$ChromeDriverCommandExecutor.<init>(ChromeDriver.java:118)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
	at no.example.webdriver.WebDriverSelector.createChromeDriver(WebDriverSelector.kt:137)
	at no.example.webdriver.WebDriverSelector.createWebDriverFor(WebDriverSelector.kt:142)
	at no.example.webdriver.WebDriverSelector.getDriver(WebDriverSelector.kt:95)
	at no.example.config.LmsModuleTestConfig.<init>(ModuleTestConfig.java:26)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)
	... 103 more

Operating System

macOS 12.1, Ubuntu 20.04

Selenium version

Java 4.1.2

What are the browser(s) and version(s) where you see this issue?

ChromeDriver 83.0.4103.14

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 83.0.4103.14

Are you using Selenium Grid?

No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
henrik242commented, Feb 7, 2022

@diemol Wow, I must be blind. Thanks for your patience! I was fooled by the comment above, I guess:

I upgraded Guava to version 30.1.1-jre and the error did not happen anymore.

0reactions
github-actions[bot]commented, Mar 10, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoSuchMethodError: 'com.google.common.collect ...
The issue comes from conflicting Guava (transitive dependency) versions. It should be fixed with the WebDriverManager version 5.1.0.
Read more >
How To Fix java.lang.NoSuchMethodError:org ... - YouTube
NoSuchMethodError : org.testng.TestRunner.addListener(Ljava/lang/Object;)V issue. ... Selenium Realtime Videos With Quick Solutions ...
Read more >
Error when running script Exception in thread main java lang ...
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap; at java.base/jdk.internal.loader.BuiltinClassLoader.
Read more >
Immutable Map in Java - GeeksforGeeks
ImmutableMap, as suggested by the name, is a type of Map which is immutable. It means that the content of the map are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found