java.lang.ClassNotFoundException / NoClassDefFoundError
The JVM couldn’t find a class on the classpath at runtime.
Seen on:
Java
Meaning
ClassNotFoundException happens when code loads a class by name (JDBC drivers, reflection) and it isn’t on the classpath. NoClassDefFoundError means the class existed at compile time but is missing (or failed static init) at runtime.
Common causes
- Dependency missing from the runtime classpath / fat JAR
- Dependency scope
provided/testused at runtime - Version conflicts between libraries
- JDBC driver not included
- Static initializer threw an exception earlier (NoClassDefFoundError)
⚡ Quick fix
- Check the dependency is in the built artifact (
jar tf app.jar | grep ClassName) - Fix Maven/Gradle scopes
- Run
mvn dependency:tree/gradle dependenciesto find conflicts - Look earlier in logs for ExceptionInInitializerError
Detailed fix by platform
Java
- Use the Spring Boot / Shadow plugin to build an executable JAR that includes dependencies.
How to diagnose
- Class — Which class and which JAR should provide it?
- Artifact — Is it in the deployed classpath?
- Init — Earlier static init failure?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026