Jackson ライブラリを使用して Json オブジェクトを逆シリアル化しようとしていますが、Joda Datetime 形式の逆シリアル化で問題が発生しています。
このコードは、次のエラーをスローします。
Lorg/joda/time/base/AbstractInstant を解決できません。注釈クラス 1557
DataWrapper list = mapper.readValue(response, DataWrapper.class);
私はすでにこれについて何かを見つけようとしていますが、何もありません。
完全なコードがあります:
public class DataWrapper {
public List<ScheduleEntry> data;
}
public static class ScheduleEntry {
public long ID;
public DateTime StartDate;
public DateTime EndDate;
public String Description;
}
WebService callWebService = new WebService(SERVICE_URI);
String response = callWebService.webInvoke("/GetScheduleEntrys", params);
ObjectMapper mapper = new ObjectMapper();
try
{
DataWrapper list = mapper.readValue(response, DataWrapper.class);
List<ScheduleEntry> items = list.data;
}
ウェブサービス:
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "GetScheduleEntrys",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
List<ScheduleEntry> GetScheduleEntrys(string Token);
JSON:
[{"Description":"Cliente José","EndDate":"/Date(1353319200000+0000)/","ID":0,"StartDate":"/Date(1353315600000+0000)/"},{" Description":"Cliente Carlos","EndDate":"/Date(1353348000000+0000)/","ID":0,"StartDate":"/Date(1353344400000+0000)/"},{"説明": "Cliente Pedro","EndDate":"/Date(1353513600000+0000)/","ID":0,"StartDate":"/Date(1353510000000+0000)/"},{"説明":"Cliente Marco ","EndDate":"/Date(1353664800000+0000)/","ID":0,"StartDate":"/Date(1353661200000+0000)/"},{"Description":"Cliente José","終了日":"/Date(1353319200000+0000)/","ID":0,"StartDate":"/Date(1353315600000+0000)/"},{"Description":"Cliente Carlos","EndDate":"/Date( 1353348000000+0000)/","ID":0,"StartDate":"/Date(1353344400000+0000)/"},{"Description":"Cliente Pedro","EndDate":"/Date(1353513600000+0000) )/","ID":0,"StartDate":"/Date(1353510000000+0000)/"},{"Description":"Cliente Marco","EndDate":"/Date(1353664800000+0000)/" ,"ID":0,"開始日":"/日付(1353661200000+0000)/"}]/Date(1353348000000+0000)/","ID":0,"StartDate":"/Date(1353344400000+0000)/"},{"Description":"Cliente Pedro","EndDate":"/Date( 1353513600000+0000)/","ID":0,"StartDate":"/Date(1353510000000+0000)/"},{"Description":"Cliente Marco","EndDate":"/Date(1353664800000+0000) )/","ID":0,"開始日":"/Date(1353661200000+0000)/"}]/Date(1353348000000+0000)/","ID":0,"StartDate":"/Date(1353344400000+0000)/"},{"Description":"Cliente Pedro","EndDate":"/Date( 1353513600000+0000)/","ID":0,"StartDate":"/Date(1353510000000+0000)/"},{"Description":"Cliente Marco","EndDate":"/Date(1353664800000+0000) )/","ID":0,"開始日":"/Date(1353661200000+0000)/"}]/Date(1353664800000+0000)/","ID":0,"StartDate":"/Date(1353661200000+0000)/"}]/Date(1353664800000+0000)/","ID":0,"StartDate":"/Date(1353661200000+0000)/"}]
完全なログ
01-03 17:39:24.700: E/dalvikvm (18494): Lorg/joda/time/base/AbstractInstant を解決できません。注釈クラス 1557 01-03 17:39:28.505: W/dalvikvm(18494): threadid=11: キャッチされない例外で終了するスレッド (group=0x40c4d1f8) 01-03 17:39:28.650: E/AndroidRuntime(18494): FATAL例外: AsyncTask #1 01-03 17:39:28.650: E/AndroidRuntime(18494): java.lang.RuntimeException: doInBackground() の実行中にエラーが発生しました 01-03 17:39:28.650: E/AndroidRuntime(18494) : android.os.AsyncTask$3.done(AsyncTask.java:278) 01-03 17:39:28.650: E/AndroidRuntime(18494): java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java: 273) 01-03 17:39:28.650: E/AndroidRuntime(18494): java.util.concurrent.FutureTask.setException(FutureTask.java:124) 01-03 17:39:28.650: E/AndroidRuntime(18494) : java.util.concurrent.FutureTask$Sync で。