HashMap.Entry not serializable?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

HashMap.Entry not serializable?

Martin Makundi
Hi!

I am a bit onfused.. I have new ListView("id", new
LinkedList(hashMap.entrySet())) and Wicket gives:

org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class: java.util.HashMap$Entry

This does not make sense, I would expect hashmap entries to be fully
serializable .. not? Any quick workarounds?

**
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: HashMap.Entry not serializable?

Russell Simpkins-2

hashMap.entrySet returns a  Set<Map.Entry> If you look at the javadocs, Set does not extend Serializable:
public interface Setextends Collection
All Superinterfaces:Collection, Iterable


----------------------------------------

> Date: Sat, 18 Jul 2009 13:06:32 +0300
> Subject: HashMap.Entry not serializable?
> From: [hidden email]
> To: [hidden email]
>
> Hi!
>
> I am a bit onfused.. I have new ListView("id", new
> LinkedList(hashMap.entrySet())) and Wicket gives:
>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: java.util.HashMap$Entry
>
> This does not make sense, I would expect hashmap entries to be fully
> serializable .. not? Any quick workarounds?
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

_________________________________________________________________
Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

Johan Compagner
In reply to this post by Martin Makundi
nope you cant serialize entries.

hashmap do there own custom serialization (just key/value) and they dont
serialize the internal structure to that data (the entries)
Thats why Entry is not serializeable

johan

On Sat, Jul 18, 2009 at 12:06, Martin Makundi <
[hidden email]> wrote:

> Hi!
>
> I am a bit onfused.. I have new ListView("id", new
> LinkedList(hashMap.entrySet())) and Wicket gives:
>
>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: java.util.HashMap$Entry
>
> This does not make sense, I would expect hashmap entries to be fully
> serializable .. not? Any quick workarounds?
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

vineetsemwal
In reply to this post by Martin Makundi
keys,values are serializable but entry itself isn't .
quick solution is to use LDM.

regards,
Vineet Semwal

On Sat, Jul 18, 2009 at 3:36 PM, Martin Makundi <
[hidden email]> wrote:

> Hi!
>
> I am a bit onfused.. I have new ListView("id", new
> LinkedList(hashMap.entrySet())) and Wicket gives:
>
>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: java.util.HashMap$Entry
>
> This does not make sense, I would expect hashmap entries to be fully
> serializable .. not? Any quick workarounds?
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

vineetsemwal
In reply to this post by Russell Simpkins-2
Russell,
Set,List,Map do not implement Serializable but their implementations do.
In the case of Entry ,it's implemented in Map implementations like hashmap .
the class which implements Entry there isn't Serializable.


regards,
Vineet Semwal




On Sat, Jul 18, 2009 at 5:22 PM, Russell Simpkins <
[hidden email]> wrote:

>
> hashMap.entrySet returns a  Set<Map.Entry> If you look at the javadocs, Set
> does not extend Serializable:
> public interface Setextends Collection
> All Superinterfaces:Collection, Iterable
>
>
> ----------------------------------------
> > Date: Sat, 18 Jul 2009 13:06:32 +0300
> > Subject: HashMap.Entry not serializable?
> > From: [hidden email]
> > To: [hidden email]
> >
> > Hi!
> >
> > I am a bit onfused.. I have new ListView("id", new
> > LinkedList(hashMap.entrySet())) and Wicket gives:
> >
> >
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> > Unable to serialize class: java.util.HashMap$Entry
> >
> > This does not make sense, I would expect hashmap entries to be fully
> > serializable .. not? Any quick workarounds?
> >
> > **
> > Martin
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> _________________________________________________________________
> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports
> pics. Check it out.
>
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

RE: HashMap.Entry not serializable?

Russell Simpkins-2

True, but if he does not cast his reference to the underlying implementation, the jvm has no way to know that the underlying implementation is serializable does it, hence the error. All the calling method knows is that you passed a Set and Set does not extend Serializable.

----------------------------------------

> Date: Sat, 18 Jul 2009 18:11:17 +0530
> Subject: Re: HashMap.Entry not serializable?
> From: [hidden email]
> To: [hidden email]
>
> Russell,
> Set,List,Map do not implement Serializable but their implementations do.
> In the case of Entry ,it's implemented in Map implementations like hashmap .
> the class which implements Entry there isn't Serializable.
>
>
> regards,
> Vineet Semwal
>
>
>
>
> On Sat, Jul 18, 2009 at 5:22 PM, Russell Simpkins <
> [hidden email]> wrote:
>
>>
>> hashMap.entrySet returns a Set If you look at the javadocs, Set
>> does not extend Serializable:
>> public interface Setextends Collection
>> All Superinterfaces:Collection, Iterable
>>
>>
>> ----------------------------------------
>>> Date: Sat, 18 Jul 2009 13:06:32 +0300
>>> Subject: HashMap.Entry not serializable?
>>> From: [hidden email]
>>> To: [hidden email]
>>>
>>> Hi!
>>>
>>> I am a bit onfused.. I have new ListView("id", new
>>> LinkedList(hashMap.entrySet())) and Wicket gives:
>>>
>>>
>> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
>>> Unable to serialize class: java.util.HashMap$Entry
>>>
>>> This does not make sense, I would expect hashmap entries to be fully
>>> serializable .. not? Any quick workarounds?
>>>
>>> **
>>> Martin
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> _________________________________________________________________
>> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports
>> pics. Check it out.
>>
>> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

_________________________________________________________________
Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

Martin Makundi
In reply to this post by vineetsemwal
Veery strange... what is LDM?

**
Martin

2009/7/18 vineet semwal <[hidden email]>:

> keys,values are serializable but entry itself isn't .
> quick solution is to use LDM.
>
> regards,
> Vineet Semwal
>
> On Sat, Jul 18, 2009 at 3:36 PM, Martin Makundi <
> [hidden email]> wrote:
>
>> Hi!
>>
>> I am a bit onfused.. I have new ListView("id", new
>> LinkedList(hashMap.entrySet())) and Wicket gives:
>>
>>
>> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
>> Unable to serialize class: java.util.HashMap$Entry
>>
>> This does not make sense, I would expect hashmap entries to be fully
>> serializable .. not? Any quick workarounds?
>>
>> **
>> Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

vineetsemwal
In reply to this post by Russell Simpkins-2
Set<Integer>set=new HashSet<Integer>();
set.add(new Integer(1));
try serializing above set  ,you won't see any problem.
you serialize a object and not interface.
set in above case is a reference to  HashSet instance  so jvm knows it.

again,Entry is not serializable ,don't confuse the problem with Set.

regards,
Vineet Semwal

On Sat, Jul 18, 2009 at 6:29 PM, Russell Simpkins <
[hidden email]> wrote:

>
> True, but if he does not cast his reference to the underlying
> implementation, the jvm has no way to know that the underlying
> implementation is serializable does it, hence the error. All the calling
> method knows is that you passed a Set and Set does not extend Serializable.
>
> ----------------------------------------
> > Date: Sat, 18 Jul 2009 18:11:17 +0530
> > Subject: Re: HashMap.Entry not serializable?
> > From: [hidden email]
> > To: [hidden email]
> >
> > Russell,
> > Set,List,Map do not implement Serializable but their implementations do.
> > In the case of Entry ,it's implemented in Map implementations like
> hashmap .
> > the class which implements Entry there isn't Serializable.
> >
> >
> > regards,
> > Vineet Semwal
> >
> >
> >
> >
> > On Sat, Jul 18, 2009 at 5:22 PM, Russell Simpkins <
> > [hidden email]> wrote:
> >
> >>
> >> hashMap.entrySet returns a Set If you look at the javadocs, Set
> >> does not extend Serializable:
> >> public interface Setextends Collection
> >> All Superinterfaces:Collection, Iterable
> >>
> >>
> >> ----------------------------------------
> >>> Date: Sat, 18 Jul 2009 13:06:32 +0300
> >>> Subject: HashMap.Entry not serializable?
> >>> From: [hidden email]
> >>> To: [hidden email]
> >>>
> >>> Hi!
> >>>
> >>> I am a bit onfused.. I have new ListView("id", new
> >>> LinkedList(hashMap.entrySet())) and Wicket gives:
> >>>
> >>>
> >>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> >>> Unable to serialize class: java.util.HashMap$Entry
> >>>
> >>> This does not make sense, I would expect hashmap entries to be fully
> >>> serializable .. not? Any quick workarounds?
> >>>
> >>> **
> >>> Martin
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [hidden email]
> >>> For additional commands, e-mail: [hidden email]
> >>>
> >>
> >> _________________________________________________________________
> >> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports
> >> pics. Check it out.
> >>
> >>
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
>
> _________________________________________________________________
> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports
> pics. Check it out.
>
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: HashMap.Entry not serializable?

vineetsemwal
In reply to this post by Martin Makundi
loadable detachable model

On Sat, Jul 18, 2009 at 7:24 PM, Martin Makundi <
[hidden email]> wrote:

> Veery strange... what is LDM?
>
> **
> Martin
>
> 2009/7/18 vineet semwal <[hidden email]>:
> > keys,values are serializable but entry itself isn't .
> > quick solution is to use LDM.
> >
> > regards,
> > Vineet Semwal
> >
> > On Sat, Jul 18, 2009 at 3:36 PM, Martin Makundi <
> > [hidden email]> wrote:
> >
> >> Hi!
> >>
> >> I am a bit onfused.. I have new ListView("id", new
> >> LinkedList(hashMap.entrySet())) and Wicket gives:
> >>
> >>
> >>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> >> Unable to serialize class: java.util.HashMap$Entry
> >>
> >> This does not make sense, I would expect hashmap entries to be fully
> >> serializable .. not? Any quick workarounds?
> >>
> >> **
> >> Martin
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>