java.lang.NoClassDefFoundError:org/json/JSONException

8519 views
Skip to first unread message

Cristian Rinaldi

unread,
Sep 16, 2011, 10:45:45 AM9/16/11
to Google Web Toolkit
I have an error when the application is deployed.
The exception is "Caused by: java.lang.NoClassDefFoundError: org/json/
JSONException". But the rare is that I have all libraries in de WEB-
INF/lib

gwt-servlet.jar
gwt-servlet-deps.jar
requestfactory-servlet.jar
validation-api-1.0.0.GA.jar

I'm not using maven and ther version of GWT is 2.4.

Thanks

Thad

unread,
Sep 16, 2011, 11:18:34 AM9/16/11
to Google Web Toolkit
I dunno a Maven repository for JSON, but you can download and build
the package yourself from http://www.json.org/java/index.html

Y2i

unread,
Sep 16, 2011, 11:47:17 AM9/16/11
to google-we...@googlegroups.com
The problem is requestfactory-server.jar may or may not have org/json/JSONException, depending where it's coming from.  Check out this thread.

Alexander Orlov

unread,
Sep 16, 2011, 11:53:34 AM9/16/11
to google-we...@googlegroups.com


On Friday, September 16, 2011 4:45:45 PM UTC+2, Cristian Rinaldi wrote:
I have an error when the application is deployed.
The exception is "Caused by: java.lang.NoClassDefFoundError: org/json/
JSONException". But the rare is that I have all libraries in de WEB-
INF/lib

gwt-servlet.jar
gwt-servlet-deps.jar
requestfactory-servlet.jar
validation-api-1.0.0.GA.jar

There is no requestfactory-servlet.jar, I suppose you mean requestfactory-server.jar which should be available during both run time and compile time. Also you don't need neither gwt-servlet-deps.jar nor gwt-servlet.jar since you're using requestfactory-server.jar. Also you probably don't need validation-api-1.0.0.GA.jar. However you must have a working Annotation Processing configuration.

Eric Medvet

unread,
Oct 31, 2011, 7:49:47 AM10/31/11
to google-we...@googlegroups.com
I have the same problem:
java.lang.NoClassDefFoundError: org/json/JSONException
at runtime when I try to call request.fire().
I tried including in my WEB-INF/lib several combinations of these jars (gwt-servlet.jar, gwt-servlet-deps.jar, requestfactory-servlet.jar, validation-api-1.0.0.GA.jar), without success.
I only realized that validation-api-1.0.0.GA.jar is needed in my application (otherwise the RF Servlet does not respond properly on /gwtRequest) and that JSONException is actually included in gwt-servlet-deps.jar and requestfactory-servlet.jar.
Any help? Thanks,

Brandon Donnelson

unread,
Oct 31, 2011, 11:01:30 AM10/31/11
to google-we...@googlegroups.com
I think you need to add the gwt-servlet-deps to the class path. right click on gwt-servlet-deps.jar and add to buildpath. I'm pretty sure that's where the json classes where.


Brandon Donnelson
Reply all
Reply to author
Forward
0 new messages