Skip to main content
Early Access: MineXHost is live and still being built. Expect maintenance and occasional outages. Check live status

java.lang.NoClassDefFoundError and ClassNotFoundException on a Minecraft server: what is missing, and which mod needed it

Updated 9 min read By MineXHost

A class is a piece of compiled code, and these errors usually mean a mod reached for one that is not on the server. The name after the colon tells you what is missing, and the stack trace under it tells you which mod wanted it. Most cases are one of three: a library mod that was never installed, a client-only mod on a server, or two mods built for different versions of each other. One wording, Could not initialize class, means something else, and it has its own section below.

What the error means

Java's documentation describes NoClassDefFoundError as the case where the class existed when the calling code was compiled but can no longer be found. ClassNotFoundException is the same miss when code looks a class up by its name at run time. When the message simply names a class, the two say the same thing on a server: a mod needs code that no jar on the server provides.

The name after the colon is the missing class, written with dots or slashes, such as org/lwjgl/glfw/GLFW or com.example.lib.Helper. Its package, the part before the last dot or slash, usually names the project it belongs to, and that is the first thing to read.

Read the missing class's package first

Package of the missing classWhat is missingFix
org/lwjgl, or net/minecraft/clientClient-side code. A dedicated server has no graphics or input libraries, so the mod asking for them is a client-only mod.Remove that mod from the server and keep it on players' machines.
Another mod's package, often a library mod'sA dependency that is not installed, or a version of it that no longer has that class.Install the library at the version the requiring mod lists.
net.minecraft (outside client), or the loader's own packagesThe mod was built for a different Minecraft or loader version, where that class exists.Install the mod's build for your exact Minecraft version and loader.
net/fabricmc/loader/implFabric Loader's internal code, which changes between loader versions. A mod in the pack was built for a different, usually older, Fabric Loader.Run the Fabric Loader version the pack declares.
Any package, after the words Could not initialize classNothing is missing. The class is there, but its one-time setup code failed earlier.Find the first error from that setup, higher in the log.

Then find who asked. The first line beginning at under the error that is not in a java., net.minecraft. or loader package is the code that needed the class, and its package belongs to the mod that needs attention. If the error is wrapped, read the last Caused by: line.

“Could not initialize class”: the class is there

java.lang.NoClassDefFoundError: Could not initialize class, followed by a class name, is a different problem. The class was found and loaded, but its one-time setup code (its static initializer) threw an error the first time it ran, and Java refuses every later use of the class. Installing a library will not help, because nothing is missing.

The real error is the first one. Look higher in the log for an ExceptionInInitializerError that names the same class; newer Java versions also print that original error as a Caused by: under this one. Whatever that first error says, such as a missing config value, a missing dependency or a client-only call, is what to fix.

The common causes

1. A library mod that is not installed

Many mods share code through library mods such as Architectury, Cloth Config or GeckoLib. A pack download that skipped one, or a mod added by hand without its library, ends here. Loaders normally stop with a clear missing-dependency message when a mod declares what it needs; a dependency the mod never declared shows up as a missing class instead.

When the loader does catch a missing dependency, it prints its own message, and that message names the library and the version.

Read the missing dependencies guide

2. A client-only mod on the server

A missing class under org/lwjgl or net/minecraft/client is a client mod on a dedicated server: the server simply has no such code. The fix is to take that mod off the server, not to find the missing class.

Client-only mods on a server have their own family of errors and their own fixes, including the case where a server mod requires one.

Read the invalid dist DEDICATED_SERVER guide

3. Two mods built for different versions of each other

A library that moved or renamed a class breaks every mod still built against the old layout. This is the same family as NoSuchMethodError: the class is gone rather than one method in it, and the fix is the same, matching versions.

4. A jar that was removed or set aside

If the class used to load and now does not, check what changed in the mods folder: a jar removed by hand, renamed so the loader skips it, or moved to a disabled folder. Putting it back is often the whole fix.

How to fix it

  1. Back up the world folder first.
  2. Read the missing class's package and match it to the table above.
  3. For a library, search its package or name on CurseForge or Modrinth, and install the version the requiring mod lists, built for your Minecraft version and loader.
  4. For a client-only mod, remove it from the server's mods folder.
  5. If the error started after you changed one mod, undo that one change first.
  6. If the pack shipped this way and fails on first boot, reinstall it cleanly before blaming a mod.

Warning

Do not fix a missing class by copying loose class files, or a jar from an unknown source, into the mods folder. Install the library mod that provides it, from its own page, at the version the requiring mod declares.

What MineXHost's launcher does with this crash

MineXEngine, our launcher, first checks whether a NoClassDefFoundError names one of the shared library mods packs commonly depend on, such as Architectury, Cloth Config, GeckoLib, Curios or Patchouli. If it does, the crash is treated as a missing dependency: the engine tries to fetch that library and restart, the same way it handles the loader's own missing-dependency crash. A ClassNotFoundException does not take that route; it goes straight to the next step.

Otherwise it looks for the mod that needed the class, not the class itself, since the missing class is a dependency and the mod calling it is the one out of step. Crash recovery is identify-only on customer servers, so that jar is named in your console and your mods folder is left as you installed it. For this crash, the one exception is a client-only mod that fails while the loader is constructing mods (the invalid dist DEDICATED_SERVER case), which can never load on a dedicated server and is moved to mods/.quarantined/. A missing class inside Fabric Loader's own internals is treated as a loader-version problem rather than blamed on a mod.

One check runs the other way. If the missing class is in a jar the engine itself moved aside as a precaution, for example a mod set aside before the first boot because it declared itself client-only, the engine puts that jar back rather than looking for something else to blame. It does that only when nothing left in the mods folder provides the class, and at most once per jar. It does not put back a jar it removed on firm evidence that the jar crashed the server; the one exception is a jar picked only because its path appeared in a crash's stack trace, which is weak evidence. Jars the engine sets aside are moved to mods/.quarantined/, not deleted.

Not every pack boots on a server. Our test results page shows how many public modpacks pass on each MineXEngine version, and how they were tested.

See the modpack test results

MineXHost runs Forge, NeoForge, Fabric and Quilt packs on MineXEngine. Our launcher detects the modpack, picks the right Minecraft loader and Java version, tunes the JVM for your RAM, and auto-recovers from the crashes that normally end a modded server's evening. Pick your RAM, paste the pack, and play.

See hosting plans

Frequently asked questions

What does java.lang.NoClassDefFoundError mean in Minecraft?

A java.lang.NoClassDefFoundError that names a class in Minecraft usually means a mod needed a class, a piece of compiled code, that no jar on the server provides, even though it existed when the mod was built. A library package after the colon means a dependency is missing or the wrong version, and org/lwjgl or net/minecraft/client means a client-only mod is on the server. If it says Could not initialize class instead, the class is present and failed its own setup earlier: find the first ExceptionInInitializerError above it.

What is the difference between NoClassDefFoundError and ClassNotFoundException?

NoClassDefFoundError is thrown when code that was compiled against a class runs and the class can no longer be found, while ClassNotFoundException is thrown when code looks a class up by its name at run time and finds nothing. On a Minecraft server both usually mean a mod needs code that no installed jar provides, and both are fixed by installing the right library or removing the mod that needs it. The exception is Could not initialize class, where the class is present and its setup failed earlier.

Why does my server crash with NoClassDefFoundError: org/lwjgl?

A NoClassDefFoundError naming org/lwjgl on a server means a client-only mod is installed, because LWJGL is the graphics and input library the game client uses and a dedicated server does not include it. Remove the mod named in the stack trace from the server's mods folder and keep it on players' machines. Packs for Minecraft 1.7.10 are the exception, since some use LWJGL on the server on purpose.

How do I find which mod is missing for a NoClassDefFoundError?

Read the package of the missing class after the colon, because it usually names the project that provides it, then search that name on CurseForge or Modrinth and install the version your mods require. To see which mod needed it, read the first stack line beneath the error that is not in a java., net.minecraft. or loader package, since that frame belongs to the mod that asked for the class.

Does MineXHost install a missing library automatically?

MineXEngine tries to fetch a missing library automatically when a NoClassDefFoundError names a shared library mod that packs commonly depend on, such as Architectury, Cloth Config or GeckoLib, and then restarts the server. For any other missing class it names the mod that needed it in your console instead of removing anything, because crash recovery is identify-only on customer servers; for this crash, the one exception is a client-only mod that fails during mod construction, which is moved to mods/.quarantined/.

Still stuck?

Every ticket is answered by a real person who plays Minecraft and knows modpacks. Send the full console output, not just the last line. Customers open a ticket from the panel; anyone can ask in our Discord.

  • Live support 5PM-12AM ET on weekdays
  • Replies typically within 12 hours
  • Limited availability on weekends