GWT: Common Exceptions – NoClassDefFoundError

This seems to be a problem that nearly everyone hits when starting with GWT. It causes confusion because the code is error free at compile time, yet throws a java.lang.NoClassDefFoundError exception at runtime. The problem is simple to correct.

The JAR-file(s) must be in the correct directory and listed in the build path.

You’ll probably have included the required library into your build path already and that’s why you’re not getting compile time errors. The additional step that is to have the JAR-file(s) that contain the required libraries be copied to your project’s war/WEB-INF/lib directory. Note that your JAR-files must exist in the root of this directory, and not in any sub-directories.

Leave a Comment