Exception in thread “main” java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

huangapple go评论137阅读模式
英文:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

问题

在创建一个新的 Selenium Java 项目并使用最新的 Selenium 版本(3.141.59)来自网站时,我遇到了以下异常:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
	at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:259)
	at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:101)
	at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
	at test.src.main(src.java:11)

Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 5 more
英文:

So while creating a new selenium java project and using the latest selenium version (3.141.59) form the website, i encountered the following exception:

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
at org.openqa.selenium.remote.service.DriverService$Builder.&lt;init&gt;(DriverService.java:259)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.&lt;init&gt;(ChromeDriverService.java:101)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:123)
at test.src.main(src.java:11)

Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more

答案1

得分: 3

事实证明,在最新的 Selenium(3.141.59)下载中,我在 Selenium 网站上找不到独立的版本。相反,我的问题是通过手动将 client-combined-3.141.59.jar 和 lib 文件夹中的所有 jar 文件添加到项目的构建路径中来解决的。

英文:

It turn out that in the latest selenium (3.141.59) download available form the selenium website I couldn't find a standalone anymore.
Instead my problem was resolved by manually adding the client-combined-3.141.59.jar and all the jar files present in the lib folder to the Build Path of the project.

huangapple
  • 本文由 发表于 2020年5月29日 05:50:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/62075120.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定