android - JsonMappingException: No suitable constructor found for type -


given api endpoint

@apimethod(name = "sendchallenge", httpmethod = httpmethod.post) public exchangelist sendchallenge(challengedata request) throws exception {   return getfromdbthenprocess(request); } 

and front end (android) call endpoint

exchangelist transfers = service.sendchallenge(request).execute(); 

i following stack trace logcat.

note: monitoring server console (localhost) , no call came in.

stacktrace:

04-08 14:58:53.261: d/dalvikvm(940): gc_concurrent freed 1394k, 15% free 12495k/14599k, paused 15ms+15ms, total 75ms … //[many of `freed` lines] 04-08 14:58:54.742: d/dalvikvm(940): gc_concurrent freed 1394k, 15% free 12506k/14599k, paused 15ms+16ms, total 85ms 04-08 14:58:55.562: w/system.err(940): com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request 04-08 14:58:55.562: w/system.err(940): { 04-08 14:58:55.562: w/system.err(940):   "code": 0, 04-08 14:58:55.562: w/system.err(940):   "message": "com.google.appengine.repackaged.org.codehaus.jackson.map.jsonmappingexception: no suitable constructor found type [simple type, class com.myapi.games.message.challengedata]: can not instantiate json object (need add/enable type information?)\n @ [source: n/a; line: -1, column: -1]" 04-08 14:58:55.572: w/system.err(940): } 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.json.abstractgooglejsonclientrequest.newexceptiononerror(abstractgooglejsonclientrequest.java:111) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.json.abstractgooglejsonclientrequest.newexceptiononerror(abstractgooglejsonclientrequest.java:38) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.abstractgoogleclientrequest$1.interceptresponse(abstractgoogleclientrequest.java:314) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.http.httprequest.execute(httprequest.java:1060) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.executeunparsed(abstractgoogleclientrequest.java:412) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.executeunparsed(abstractgoogleclientrequest.java:345) 04-08 14:58:55.572: w/system.err(940):  @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.execute(abstractgoogleclientrequest.java:463) 04-08 14:58:55.572: w/system.err(940):  @ com.myapi.games.utils.sendchallenge.doinbackground(sendchallenge.java:70) 04-08 14:58:55.582: w/system.err(940):  @ com.myapi.games.utils.sendchallenge.doinbackground(sendchallenge.java:1) 04-08 14:58:55.582: w/system.err(940):  @ android.os.asynctask$2.call(asynctask.java:287) 04-08 14:58:55.582: w/system.err(940):  @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) 04-08 14:58:55.582: w/system.err(940):  @ java.util.concurrent.futuretask.run(futuretask.java:137) 04-08 14:58:55.582: w/system.err(940):  @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) 04-08 14:58:55.592: w/system.err(940):  @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) 04-08 14:58:55.592: w/system.err(940):  @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) 04-08 14:58:55.592: w/system.err(940):  @ java.lang.thread.run(thread.java:856) 

this appengine connected android project. compiles without errors, etc. pojo challengedata made of 3 other pojos similar to:

public class challengedata{    credit credit;   coin  coin;   friend friend;    //getters , setters } 

then both credit , coin contain simple fields (i.e. int , string) friend contains simple fields , further pojo.

i don't think depth of json (i.e. pojo relations) should matter. include details same.

you may getting error because sending images through endpoint api , forgot encode them in base64. must encode images base64 string. here link code snippet showing how this. rememeber encoding byte string. reason guess because mention server not getting hit , yet getting 400 bad request error, means google intercepting call , not able parse request. try out.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -