Exception in thread "main" java.lang.NoClassDefFoundError: org/
objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
at net.sf.cglib.core.KeyFactory.<clinit>(KeyFactory.java:66)
at Test.main(Test.java:8)
To ensure asm.jar is definitely in the classpath, I'm running it as:
java -classpath .;$JAVA_HOME/lib;$CGLIB_LIB/cglib-2.1_3.jar;$CGLIB_LIB/
asm.jar;$CGLIB_LIB/aspectwerkz-core-0.10.RC1.jar;$CGLIB_LIB/ant.jar;
$CGLIB_LIB/asm-attrs.jar;$CGLIB_LIB/asm-util.jar;$CGLIB_LIB/jarjar.jar;
$CGLIB_LIB/junit.jar KeySample
The call in net.sf.cglib.core.KeyFactory which is triggering this is:
private static final Type KEY_FACTORY =
TypeUtils.parseType("net.sf.cglib.core.KeyFactory");
The call at net.sf.cglib.core.TypeUtils.parseType is:
public static Type parseType(String s) {
return Type.getType(map(s));
}
map is a private method which effectively transforms the input into
"L"+s.replace('.', '/'))+";" (i.e. "Lnet/sf/cglib/core/KeyFactory;").
I've traced through this with Eclipse, so I'm absolutely certain that
this is what's being passed to Type.getType. Based on the exception
and my trace, I don't think it's getting as far as calling
Type.getType, though.
If I add the lines:
org.objectweb.asm.Type t = Type.getType("Lnet/sf/cglib/core/
KeyFactory;");
System.out.println(t.getClassName());
to the sample code, those lines execute properly (i.e. it prints
"net.sf.cglib.core.KeyFactory"), but then it throws the exception
above.
The fun part is that I get the same result if I re-compile the
original sample code and run with the no-dependency version of cglib:
java -classpath .:$JAVA_HOME/lib:$CGLIB_LIB/cglib-nodep-2.1_3.jar
KeySample
I suspect that there's something truly screwed up with my environment,
but I haven't seen any other overt misbehavior like this. Any ideas?
>NoClassDefFoundError
this is probably the hardest of all exceptions to track down since it
has so many causes.
see
http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com