JSON - ClassNotFoundException at runtime

Hello everyone,

I need to use JSON in my Vaadin-Application so I added these two tags to my gwt.xml file:

Then I imported these packeges in my class (as described in this gettingStarted tutorial
http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/GettingStartedJSON
) :

import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONException;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;

Then I started codig and everything looked pretty well. But at runtime I alwas get a ClassNotFoundException:

java.lang.ClassNotFoundException: com.google.gwt.json.client.JSONValue

What am I missing? I’m kind of stuck and would appreciate some help :slight_smile:

Kind regards,

Andreas

It looks like you’re missing the class files in your app.

Importing the classes in your code makes the IDE and compiler happy, but it doesn’t mean the classes are available in your war file at runtime. Do these missing classes exist in your app? If not, the container can’t find them to use them and you’ll get this error. I don’t have a lot of info to go on (e.g. how you built your app), but can you do ‘jar tvf myapp.war’ and share the output?

If you have a bunch of jars and aren’t sure which ones have the bits your missing, there are a bunch of tools out there for search for classes in a pile of jars. But I think I wrote
the first one
. :wink: (It started long before its current java.net incarnation.)

Cheers,
Bobby