NoClassDefFoundError means the JVM needed a class, the code referencing it compiled fine (so the class existed at build time), but at runtime the class loader cannot find it, or found it and failed to initialize it. The message names the missing class in internal form, for example com/example/Widget. Two root causes account for nearly all cases: the jar containing the class is not on the runtime classpath, or the class's static initializer threw an exception the first time the class was touched.
/ with . to get the real class name, then identify which library provides it and whether that jar is in the deployed artifact (inside the fat jar, the lib folder, the webapp's WEB-INF/lib, or the module path).ExceptionInInitializerError with the real exception the first time the class was used; every later attempt reports NoClassDefFoundError for the same class. Find the first failure, it is the informative one.provided in Maven, excluded by a Gradle configuration, or present in the IDE but not packaged, produces exactly this pattern: compiles, runs in the IDE, fails when deployed.provided scope, include the module in the assembly or shade configuration), then verify by listing the built artifact's contents for the class file itself.ExceptionInInitializerError: the nested cause (a missing config file, a failed native load, a null property) is the real bug; the class was present all along.What is the difference between NoClassDefFoundError and ClassNotFoundException? ClassNotFoundException is a checked exception thrown when code asks for a class by name (Class.forName, driver loading) and it is absent. NoClassDefFoundError is an error raised by the JVM when a class referenced directly by compiled code cannot be loaded. Same underlying absence, different doorway, and they have separate fixes pages because the code paths differ.
Why does it work in my IDE but not from the jar? The IDE builds a classpath from every project dependency; the packaged artifact contains only what the build configuration includes. The difference between those two lists is where the missing jar sits.
The class is in the jar, I checked. What now? Then suspect the static initializer or a classloader split: search the log from the first occurrence for ExceptionInInitializerError, and check whether two loaders each loaded their own copy of a related class.