java.lang.NoClassDefFoundError for org.json.JSONObject on my local installation

5,011 views
Skip to first unread message

Hairuddin Thaif

unread,
Dec 6, 2017, 1:36:43 AM12/6/17
to App Inventor Open Source Development
Hi all, 

I'm using App Inventor for quite some time and recently (yesterday exactly) I decided to build it from source code in my notebook.

After successfully import my project from aia file to local server and opened it, I've got an error message on top of chrome browser "Server error: could not save settings. Please try again later!". And in console window I see an error message "java.lang.NoClassDefFoundError: org.json.JSONObject".

I thought it related to library file that maybe missing, but I see theres a file named 'json.jar' in folder 'appinventor/appengine/build/war/WEB-INF/lib'.

I've googled this issue but apparently there's no one ever faced this problem.

FYI, I'm using Windows7 and I'm running dev server with administrator credentials.

Am I missing something?

TIA.

-- Hairuddin.

Evan Patton

unread,
Dec 6, 2017, 7:02:38 PM12/6/17
to App Inventor Open Source Development
If you ran ant clean and then ant while the build server was running, it might be referencing an directory that no longer exists. What happens if you try restarting the development server (without any ant commands)?

Evan

Hairuddin Thaif

unread,
Dec 6, 2017, 7:47:50 PM12/6/17
to App Inventor Open Source Development
I've restarted it many times, and I never build anything while the server was running.

I'll try ant clean and rebuild it.

Thanks.

Hairuddin Thaif

unread,
Dec 6, 2017, 10:15:15 PM12/6/17
to App Inventor Open Source Development
The problem still presist. This is the error message:

Dec 07, 2017 10:00:08 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void com.google.appinventor.shared.rpc.project.ProjectService.storeProjectSettings(java.lang.String,long,java.lang.String) throws com.google.appinventor.shared.rpc.InvalidSessionException' threw an unexpected exception: java.lang.NoClassDefFoundError: org.json.JSONObject$Null is a restricted class. Please see the Google  App Engine developer's guide for more details.
        at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:416)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:605)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
...
...
...
Caused by: java.lang.NoClassDefFoundError: org.json.JSONObject$Null is a restricted class. Please see the Google  App Engine developer's guide for more details.
        at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:50)
        at org.json.JSONObject.<clinit>(JSONObject.java:146)
        at com.google.appinventor.server.properties.json.ServerJsonParser.parse(ServerJsonParser.java:31)
...
...

FYI: I'm using JDK version 1.8.0_144 and Google cloud sdk version 182.0.0

I'm running the server with "java_dev_appserver.cmd" command.

Thanks for replying.

Moliata

unread,
Dec 7, 2017, 12:54:59 PM12/7/17
to App Inventor Open Source Development
1. Did you download App Engine standard Java environment?
2. Also, server is called dev_appserver.cmd not java_appserver.cmd
3. If none of those work, try fixing classpath
Best regards, Ben (@moliata at GitHub)

Hairuddin Thaif

unread,
Dec 7, 2017, 8:00:53 PM12/7/17
to App Inventor Open Source Development
1. I did, it's version is 1.9.59
2. I don't see any "dev_appserver.cmd", all I see was "java_dev_appserver.cmd", I assumed it's the same.
3. You can consider me as newbie in java, all I know I can specify classpath when I run java.exe, but I don't know how to fix classpath in AI. I've searched everywhere before I'm posting in this problem here.

Thanks for replying.

-- Hairuddin.

Hairuddin Thaif

unread,
Dec 8, 2017, 4:38:19 AM12/8/17
to App Inventor Open Source Development
Well, apparently the java_dev_appserver.cmd is different than dev_appserver.cmd.

I download manually appengine-java-sdk-1.9.59.zip and extract it in new folder, theres dev_appserver.cmd, added it to path, rerun the dev server and the problem still exists.

And I realized that -cp in dev_appserver.cmd is for define the classpath, so I add the classpath with "war\WEB-INF\lib\*.jar", rerun the dev server and nothing changes, I still got the same error message.

Any suggestions?

TIA.

-- Hairuddin

Moliata

unread,
Dec 8, 2017, 8:27:02 AM12/8/17
to App Inventor Open Source Development
Hello, what happens if you add only missing lib to cp?

Evan Patton

unread,
Dec 8, 2017, 8:24:35 PM12/8/17
to App Inventor Open Source Development
This may or may not be an issue with that version of the App Engine dev server. I have been using 1.9.49 and it does not exhibit this issue. Also, is dev_appserver.cmd or your App Inventor sources in a directory that contains a space? If so, that could be causing problems trying to find dependencies.

Evan

Hairuddin Thaif

unread,
Dec 10, 2017, 6:21:51 AM12/10/17
to App Inventor Open Source Development
I've tried that, but still error.

Hairuddin Thaif

unread,
Dec 10, 2017, 6:26:03 AM12/10/17
to App Inventor Open Source Development
I downloaded App Engine version 1.9.49 but still error, and then I download JDK version 7 and using app engine ver 1.9.59 and all run well. Problem solved.

Thank you all for your help.

Evan Patton

unread,
Dec 12, 2017, 10:50:03 AM12/12/17
to App Inventor Open Source Development
Which version of Java were you using originally? It would be good to note this in case others have similar problems in the future.

Evan

Hairuddin Thaif

unread,
Dec 16, 2017, 3:50:59 AM12/16/17
to App Inventor Open Source Development
Sorry for late reply,

Previously, I'm using JDK version 1.8.0_144 and it's installed in Program Files folder.
And now I'm using java version 1.7.0_80 for AI2 (extracted in "E:\bin" folder).
Reply all
Reply to author
Forward
0 new messages