java.lang.NoClassDefFoundError:com/google/common/collect/Maps - Selenium

2024-03-08

尊敬的硒专家,

我在 JPA 2.0 程序中遇到了以下运行时错误,由于某种原因,该错误似乎与 Firefox Profile 相关:



Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
    at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:56)
    at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:79)
    at model.DownloadCarDetail.getMercedezDetail(model.DownloadCarDetail:72)
    at model.DownloadCarDetail.getMercedezDetail.main    (model.DownloadCarDetail.getMercedezDetail.java:47)
    Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more
Java Result: 1
  

我将 Firefox 保留为版本 15,以便 Selenium Webdriver 支持它,但怀疑问题与无法读取配置文件目录有关。

非常感谢您的帮助。

非常感谢,

George


您看到的问题与您的 Firefox 配置文件无关。

实际上,是 JVM 类加载器抱怨找不到com.google.common.collect.Maps class.

这通常意味着您没有Guava http://code.google.com/p/guava-libraries/(这是 Selenium 的依赖项)在类路径上。清理并重建您的项目,检查您的类路径,检查可能存在的各种版本的库。如果您正在使用某种依赖管理系统(Maven、Ivy 等),请检查其配置是否正确。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

java.lang.NoClassDefFoundError:com/google/common/collect/Maps - Selenium 的相关文章

随机推荐