Archive

Posts Tagged ‘NoClassDefFoundError’

GWT – java.lang.NoClassDefFoundError when using .jars with eclipse

08:55 PM 2 comments

10.12.2009 19:19:19 com.google.apphosting.utils.jetty.JettyLogger warn
WARNUNG: Nested in javax.servlet.ServletException: init:
java.lang.NoClassDefFoundError: org/jibble/pircbot/PircBot
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)

project_right_clickThis exception can occure, when you try to use an .jar with GWT on the server side. The error message tells you, that the included path to your .jar (in this case org.jibble.pircbot.PircBot) can not be found. This normally happens, when you have forgotten to put the .jar into your build-path. When running GWT, the normal include into the build-path is not everything you need to do:

The normal way to include the .jar to your build-path is to edit the properties of your project, by right-clicking your project. In the Project Propertiesappearing window, you select “Java Build Path”. There you normally add your external .jars.

When using the GWT-Plugin in eclipse, this isn’t the only thing you have to do. Additionally, you need to copy the .jar into the WAR-directory of your project. The exact path is: YouProject/war/WEB-INF/lib/.

After putting the .jar into this directory, your local GWT-Runtime will work and not throw this error again. The reason is, that the GWT-Runtime of eclipse does not use the eclipse environment. It uses only the files of your “war”, which will be deployed to your application-server later.

Categories: GWT Tags: , , , ,