Error when creating Java Objects from JSON

1 post / 0 new
Offline
Last seen: 4 years 11 months ago
Joined: 11/20/2014
Posts: 1
Error when creating Java Objects from JSON

Hi,

   We used RTI Connext 5.1.0 -> Utilities -> code generator to create Java classes from IDL. We are able to create JSON from Java objects using GSON, but we were not able to create Java objects from JSON (deserialization) using GSON and Jackson. We are getting error with sequence parameters, below is log trace.

Exception in thread "main" java.lang.ClassCastException: incorrect element type
at com.rti.dds.util.Utilities.rethrow(Utilities.java:92)
at com.rti.dds.util.Sequences.checkType(Sequences.java:73)
at com.rti.dds.util.Sequences.checkElementType(Sequences.java:55)
at com.rti.dds.util.AbstractSequence.add(AbstractSequence.java:87)
at java.util.AbstractList.add(Unknown Source)
at com.rti.dds.util.AbstractSequence.add(AbstractSequence.java:102)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
at com.google.gson.Gson.fromJson(Gson.java:803)
at com.google.gson.Gson.fromJson(Gson.java:768)
at com.google.gson.Gson.fromJson(Gson.java:717)
at com.google.gson.Gson.fromJson(Gson.java:689)

Can any one help on this.

Organization: