TestNG works fine for me but throws com.google.inject.internal.asm.util.TraceClassVisitor classnotfoundexception for other engineer
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 ca开发者_如何学JAVAusing 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.
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.
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.
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!
精彩评论