Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

cglib/asm NoClassDefFoundError

Thread view: 
deacent - 10 Mar 2008 18:25 GMT
I'm having trouble running the cglib sample KeySample
http://cglib.sourceforge.net/xref/samples/KeySample.html. It compiles
fine, but when I try to run it, I get:

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?
Roedy Green - 12 Mar 2008 10:52 GMT
On Mon, 10 Mar 2008 10:25:27 -0700 (PDT), deacent
<jen.w@mavericklabel.com> wrote, quoted or indirectly quoted someone
who said :

>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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.