0
Caused by: java.io.NotSerializableException: org.apache.http.message.BasicNameValuePair

我有一个名为的类RequestData,其中包含一个

列表<名称值对>。

在将数据设置到该列表时我做

paramList.add(new BasicNameValuePair("abc","xyz"));

现在我有一个

私有静态队列 <RequestData> requestDataQueue = new LinkedBlockingQueue<RequestData>();

它将多个 RequestData 对象按顺序存储在另一个类中。

这就是我的 RequestData 类的外观。

/**
 * The Requests sent for the server are of this class` format.
 * */
public class RequestData implements Serializable
{
    static final long serialVersionUID = 89698204;

    private UUID uuid;
    private String url;
    private List<NameValuePair> paramList;

... // getter setters follows
}

但是当我去序列化或反序列化时它给出了异常。

08-16 17:29:24.595: W/System.err(9684): java.io.WriteAbortedException: Read an exception; java.io.NotSerializableException: org.apache.http.message.BasicNameValuePair
08-16 17:29:24.595: W/System.err(9684):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:804)
08-16 17:29:24.595: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
08-16 17:29:24.595: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
08-16 17:29:24.595: W/System.err(9684):     at java.util.ArrayList.readObject(ArrayList.java:657)
08-16 17:29:24.595: W/System.err(9684):     at java.lang.reflect.Method.invokeNative(Native Method)
08-16 17:29:24.595: W/System.err(9684):     at java.lang.reflect.Method.invoke(Method.java:511)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1354)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1266)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1855)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1137)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:455)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1369)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1266)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1855)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
08-16 17:29:24.603: W/System.err(9684):     at java.util.concurrent.LinkedBlockingQueue.readObject(LinkedBlockingQueue.java:875)
08-16 17:29:24.603: W/System.err(9684):     at java.lang.reflect.Method.invokeNative(Native Method)
08-16 17:29:24.603: W/System.err(9684):     at java.lang.reflect.Method.invoke(Method.java:511)
08-16 17:29:24.603: W/System.err(9684):     at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1354)
08-16 17:29:24.611: W/System.err(9684):     at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1266)
08-16 17:29:24.611: W/System.err(9684):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1855)
08-16 17:29:24.611: W/System.err(9684):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
08-16 17:29:24.611: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)
08-16 17:29:24.611: W/System.err(9684):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)
08-16 17:29:24.611: W/System.err(9684):     at com.expersis.newpm.data.OfflineDataStore.deserializeData(OfflineDataStore.java:35)

我还看到指向 LinkedBlockingQueue 的异常,但这应该不是问题。我也在使用

org.apache.http.message.BasicNameValuePair 实现了可序列化。

不知道是什么问题

请指导...

4

0 回答 0