Mike Perham wrote:
I found the problem.  It had nothing to do with maven and everything to
do with the VM's incompetent error reporting.  The problem was that the
DateLiteralBean class below linked to classes in jarA which linked to
classes in jarB.  JarB was not in the classpath.


2750 [main] ERROR net.sf.hibernate.proxy.LazyInitializer  - CGLIB
Enhancement failed
java.lang.NoClassDefFoundError:
com.webify.framework.triples.beans.DateLiteralBean
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:1655)
        at java.lang.Class.getDeclaredMethod(Class.java:1262)
        at


You might want to reconsider your evaluation of the VM's error reporting. If it 
were merely a question of not finding 
com.webify.framework.triples.beans.DateLiteralBean, then you would have seen 
java.lang.ClassNotFoundException.

Instead the VM produced java.lang.NoClassDefFoundError. In my experience the 
error report and the Javadoc are somewhat misleading, but each provides 
information that should allow you to diagnose the problem, if you look hard 
enough, which you did.


From the Javadoc:

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in 
the definition of a class (as part of a normal method call or as part of 
creating a new instance using the new expression) and no definition of the 
class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.


The misleading aspect of the error message is as follows: when a classloader 
goes to load a class that is visible to it, you will see the 
NoClassDefFoundError under but not limited to the following circumstances:

1) the named class or some other class being loaded as a consequence of loading the named class is visible to the classloader and 1 or more methods or fields referenced in that class do not exist in the the byte code being loaded
2) some other class or possibly a library or resource referenced in the newly loaded 
class's implicit class graph cannot be found and loaded. When the error message or the 
Javadoc state "the class" they are being overly specific, any downstream loader 
failure during the load of the named class will cause NoClassDefFoundError to be thrown.

If you interpret this error message to mean java.lang.ClassNotFoundException, then yes the 
message error reporting is incompetent, but if you interpret the message to mean, that the 
classLoader attempted to load the class named 
com.webify.framework.triples.beans.DateLiteralBean and at some point during the class' 
<init> or instance's <ctor> initialization an unspecified loader error was 
detected, then its not exactly incompetent, its just not very helpful.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to