java - Jackson: Can not deserialize instance of Number out of START_OBJECT token -
my gwt service returns linkedlist<visualdata>
. how visualdata
looks:
import javax.xml.bind.annotation.xmlrootelement; import com.google.gwt.user.client.rpc.isserializable; @xmlrootelement public class visualdata implements isserializable { private number value; private long timestamp; public visualdata() { } public visualdata(number value, long timestamp) { this.value = value; this.timestamp = timestamp; } public long gettimestamp() { homecoming timestamp; } public number getvalue() { homecoming value; } public void settimestamp(long timestamp) { this.timestamp = timestamp; } public void setvalue(number value) { this.value = value; } }
i next excepion connected field private number value
.
severe: exception contained within mappablecontainerexception not mapped response, re-throwing http container org.codehaus.jackson.map.jsonmappingexception: can not deserialize instance of java.lang.number out of start_object token @ [source: org.apache.catalina.connector.coyoteinputstream@a0eb51; line: 1, column: 29] (through reference chain: org.jage.charts.client.visualdata["value"])
when alter private number value
private object value
, getters , setters get:
severe: webmodule[/agecharts]exception while dispatching incoming rpc phone call com.google.gwt.user.client.rpc.serializationexception: type 'org.jage.charts.client.visualdata' not included in set of types can serialized serializationpolicy or class object not loaded. security purposes, type not serialized.: instance = value:{@type=xs:int, $=6}, timestamp:1360240281439 @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serialize(serverserializationstreamwriter.java:619)
this sec case quite clear, object
class not serializable. why can not deserialize instance of java.lang.number out of start_object token
?
you won't able deserialize info object without supplying additional type info value
field. because number
class abstract , cannot instantiated. changing field object
not help, since there no writable fields on class jackson can deserialize info into.
you should alter field 1 of concrete implementations of number
class (integer
, long
, double
etc).
java json gwt serialization jackson
No comments:
Post a Comment