TestNG 对我来说工作正常,但对其他工程师抛出 com.google.inject.internal.asm.util.TraceClassVisitor classnotfoundException

发布于 2024-09-14 22:09:48 字数 344 浏览 1 评论 0原文

我的 ANT 脚本在我的 Linux 机器和一些 XP 虚拟机上运行没有问题。当另一位工程师尝试在本地启动它时,TestNG 会抛出 [testng] Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.asm.util.TraceClassVisitor not found in (我的库都在这里)

I'我以前从未见过这个类,也不知道是什么导致这种情况只发生在他的机器上。我尝试导入 asm-util-3.1.jar 但找不到它,因为它在 com.google.internal.asm.util 而不是 org.objcetweb.asm.util 中查找。

My ANT script runs without issue on my linux machine and on some xp VMs. When another engineer tries to kick it off locally, TestNG throws [testng] Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.asm.util.TraceClassVisitor not found in (my libraries are all in here)

I've never seen this class before and don't know what is causing this to only happen on his machine. I've tried importing asm-util-3.1.jar but it doesn't find it since it looks in com.google.internal.asm.util and not org.objcetweb.asm.util.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

带上头具痛哭 2024-09-21 22:09:48

在使用 Eclipse TestNG 插件时,我们遇到了类似的错误:

testng java.lang.noclassdeffounderror: com/google/inject/internal/Lists

这看起来可能是 Guice 版本的差异
从类路径加载 - Guice 2.0 具有上面的类
而在 Guice 3.0 中,它似乎已经转移到:

com/google/inject/internal/util/Lists

TestNG Eclipse 插件的更新版本修复了该问题。

We got a similar error when using the Eclipse TestNG plugin:

testng java.lang.noclassdeffounderror: com/google/inject/internal/Lists

This looks like it might be a difference in the versions of Guice which
are getting loaded in from the classpath - Guice 2.0 has the class above
whereas in Guice 3.0 it seems to have moved to:

com/google/inject/internal/util/Lists

An updated version of the TestNG Eclipse plugin fixed the problem.

夏见 2024-09-21 22:09:48

它看起来确实像是与 Guice 或 Asm 相关的问题。您是否将 TestNG 与 Maven 一起使用,还是直接从 http://testng.org 下载的 jar 文件?

Maven 版本仅包含 TestNG 类,并让 Maven 下载所有其他依赖项。

jar 文件包含所有依赖项,包括 guice.jar,因此如果您已在环境中使用不同版本的 Guice,则可能会导致冲突。

It does look like an issue related to either Guice or Asm. Are you using TestNG with Maven or the jar file downloaded directly from http://testng.org ?

The Maven version only contains the TestNG classes and lets Maven download all the other dependencies.

The jar file contains all the dependencies, including guice.jar, so this might cause a conflict if you are already using a different version of Guice in your environment.

假装爱人 2024-09-21 22:09:48

事实证明,虽然他安装了正确的 Java 版本并由他的环境指向,但在 Java 的 .conf 文件深处,有一个对旧 1.5 安装的引用 (JVM_ROOT)。感谢塞德里克的帮助!

Turns out that while he had the proper version of Java installed and pointed to by his environment, deep down within the depths of Java's .conf file there was a reference (JVM_ROOT) to an old 1.5 install. Thanks for the help Cedric!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文