-
1. Re: Jboss 7.1.1 external jar load issue!
andey Jan 26, 2018 6:18 AM (in response to rahulcse03)There is no ClassDefNotFoundException in standard Java lib..
Typically, NoClassDefFoundError is thrown if the class failed to initialize.
When a class is used for the 1st time, it's being initialized. if that fails for whatever reason, the relevant exception is thrown. http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.4
When the class is used again, it's known to be corrupt. Initialization won't be attempted again. JVM throws the mysterious NoClassDefFoundError. Not really descriptive of the problem, could be quite confusing for diagnosis. It would be better if something like ClassInitFailedError is thrown.
When you see a NoClassDefFoundError, you should search the log backwards, find the root cause why the class failed to initialize (hopefully it's logged)..
NoClassDefFoundError happens when class cannot be instantiated by new because the jvm failed to initialize the class. It could be the constructor threw exceptions, or static block threw up, or version mismatch.