TestNG 对我来说工作正常,但对其他工程师抛出 com.google.inject.internal.asm.util.TraceClassVisitor classnotfoundException
我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在使用 Eclipse TestNG 插件时,我们遇到了类似的错误:
这看起来可能是 Guice 版本的差异
从类路径加载 - Guice 2.0 具有上面的类
而在 Guice 3.0 中,它似乎已经转移到:
TestNG Eclipse 插件的更新版本修复了该问题。
We got a similar error when using the Eclipse TestNG plugin:
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:
An updated version of the TestNG Eclipse plugin fixed the problem.
它看起来确实像是与 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.
事实证明,虽然他安装了正确的 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!