All Java programmers have encountered one or both of these errors at some point of compiling or running a java code. This support note elaborates on the possible cause of such errors.
JVM uses a class called classloader to load other classes into memory before executing the java byte code. The classloader class offers many methods such as loadClass() to load a compiled java class file from local file system. It is possible to write our own classloader to load a class from other sources than local or network file system. BOF class loader is such an example. DFC uses this custom class loader to load BOF classes from the local file system BOF cache folder. If the BOF class is no there, then it
1) automatically connects to Global repository using username and password specified in dfc.properties file
2) downloads the BOF classes from global repository to BOF cache area
3) Loads the BOF classes in memory.
However, if all attempts of loadClass() method fails for a ClassLoader, then the ClassLoader programmer notifies JVM this exception by throwing a ClassNotFound or NotClassDefFound exception.
The subtle difference between two (mostly depends on the programmer, who has coded the ClassLoader) are basically as follows
ClassNotFound exception means the ClassLoader code has failed to locate the compiled class byte code in all possible locations pointed by classpath or as hardcoded by class search logic. The most probable cause is the class file or jar/zip file containing the class is missing from the classpath or hardcoded locations (local file system, network or Web URL).
NoClassDefFound means, ClassLoader has failed to load the class because either it has failed to locate it or has encountered a runtime exception in locating any additional resources referenced by the loading class. In other words, NoClassDefFound not always indicates the class is missing from the search location, but something happened while ClassLoader is trying to load that class. A typical scenario will be some other classes or interfaces, referenced by the erring class is
a) missing
b) corrupted installation
c) incomplete libraries
d) duplicate entries of same jar file in the classpath
e) Missing jar/zip file entry in the classpath.