java.lang.ExceptionInInitializerError
A static initializer (static block or static field) threw an exception while the class was loading.
Seen on:
Java
Meaning
The real cause is in “Caused by:”. After this the class is unusable, and later accesses throw NoClassDefFoundError: Could not initialize class.
Common causes
- Static config reading a missing file/env var
- Static field initialization throwing
- Incompatible JDK/library (e.g. Lombok on new JDK)
⚡ Quick fix
- Read the “Caused by” section
- Move risky work out of static initializers
- Upgrade libraries for your JDK
Detailed fix by platform
Java
- Lazy-initialise heavy static resources instead of loading them in static blocks
How to diagnose
- Cause — What does Caused by say?
- Class — Which class failed to initialize?
🧠 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