Re: Serialization errors

[email protected] Thu, 29 Jan 2009 11:20:21 +1000
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
Had a bit more of a look and think.

The first question is whether the meta data should be serialized at all.  Class info is not serialized for POJOs.  In any case we should have a basic check that it is valid, eg. nr of fields match.

It is not clear why the SRecordMeta would be serialized at all.  The link from instances to records is getMeta, which normally refers to a static.  But if the user happened to create it using non-static and non transient, then the serialization could run all over the place.  This at least needs to be documented.  

It is also not at all clear whether SRecordMeta is in fact being serialized at all in our test cases!  The readResolve might be dead code.  I am not aware of any tools to debug Serialization.  Even just seeing what is in the binary serialized file is hard.  Let alone figuring out what and why.  I suspect that one needs to poke around in the Java source itself and add trace.

http://crazybob.org/2007/02/debugging-serialization.html has help on exceptions.   Also have not tried -Dsun.io.serialization.extendedDebugInfo=true 

All ideas welcome.

Anthony

At 10:13 AM 29/01/2009, you wrote:
>To: [email protected]
>From: [email protected]
>Subject: Re: [SimpleORM] Serialization errors
>In-Reply-To: <23405065.21232638320524.JavaMail.SYSTEM@blacktip>
>References: <23405065.21232638320524.JavaMail.SYSTEM@blacktip>
>
>Hello Carl,
>
>I did not write the serialization part.  Looks like it needs a bit more thought.  
>
>The page you refer to is rather unintelligible, but the idea that the objects are fully instantiated before the replacement is a bit scary.  There is lots of opportunity for problems.
>
>I strongly suspect that we should be using the (new?) Externalizable interface.
>
>There should ideally also be some test to make sure that the user classes are actually the same as the non-deserialized one etc.
>
>I think that Franck and others use it.  So it at least basically works.  
>
>There is a test case in LongTransactionTest, but it is within the same JVM.  You must be doing something a bit unusual to produce the bug.  As a first step can you please create a simple test case that reproduces the problem and send it to me.
>
>This requires some thought and investigation.  Sadly I am busy at the moment.  Maybe Franck can have a look?
>
>Anthony
>
>
>At 01:32 AM 23/01/2009, you wrote:
>
>>Hello, 
>>
>>I'm getting errors trying to deserialize some SimpleORM objects. (using serialization is necessary due to the the way I am integrating SimpleORM with Wicket) 
>>
>>It seems that SRecordMeta uses readResolve() to treat itself as a singleton, but I don't think that you can do this if the object graph that you're serializing contains the record meta (such as if you're serializing a SFieldMeta), because of the wording here: http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/input.doc6.html (the "Note" section in particular). 
>>
>>The error I'm getting is:
>>java.lang.NullPointerException 
>>
>>at simpleorm.dataset.SRecordMeta.getField(SRecordMeta.java:246) 
>>
>>at simpleorm.dataset.SFieldMeta.readResolve(SFieldMeta.java:186) 
>>
>>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
>>
>>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>>
>>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
>>
>>at java.lang.reflect.Method.invoke(Method.java:585) 
>>
>>at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1033) 
>>
>>at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1728) 
>>
>>...etc 
>>
>>Any help is appreciated, 
>>
>>Thanks,
>>Carl Gould
>>Inductive Automation
>>[email protected]
>>1.800.266.7798 
>> 
>
>
>Spreadsheet Detective,
>Southern Cross Software Queensland Pty Limited
>54 Gerler Street
>Bardon, Queensland 4065, Australia.
>
>Email: [email protected]
>www.SpreadsheetDetective.com
>Ph: +61 427 830248 (Australian Eastern Standard Time)
>
>"If the model seems correct only because the numbers look right, 
>then why build the model in the first place?"

Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.


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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/