Problem with Serialization

I try to serialize TerrainBlock and it works after adding serialization to Triangle and OBBTree. But loading breaks with:


java.lang.IllegalStateException: unread block data

It might be that some custom Serialization routines - writeObject/readObject - are not properly sync'd.  Can you narrow it down to a specific Class by playing with what is being serialized a bit?  That would help out a lot.

How can I debug that? I don't really have experience with Serializable.

Is there a viewer for the serialized stream? I think that would help.

Well, the poor man's method would be to try chainging what you are serializing/deserializing from TerrainPage -> various fields in TerrainPage (remember to do fields of the parent class) and see which has a problem.

There is a problem in serializing a TriMesh if there is a texture state. A very simple TriMesh without TextureState works.


java.io.NotSerializableException: java.nio.DirectFloatBufferU
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.writeArray(Unknown Source)
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
        at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
        at com.jme.scene.Geometry.writeObject(Geometry.java:650)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.writeObject(Unknown Source)
        at de.worldofmystery.client.Client.createGeo(Client.java:516)
        at de.worldofmystery.client.Client.onCommand(Client.java:453)
        at de.worldofmystery.client.Client$ChatListener.update(Client.java:764)
        at de.worldofmystery.client.input.WomKeyboardHandler.stopCaptureInput(WomKeyboardHandler.java:75)
        at de.worldofmystery.client.input.WomKeyboardHandler$AllKeyListener.onKey(WomKeyboardHandler.java:106)
        at com.jme.input.lwjgl.LWJGLKeyInput.update(LWJGLKeyInput.java:118)
        at com.jme.input.InputSystem.update(InputSystem.java:68)
        at com.jme.app.BaseGame.start(BaseGame.java:71)
        at de.worldofmystery.client.Client.main(Client.java:123)



Edit: There is an error while serializing, the error on deserializing is because it could not save the instance.

The problem with serialization is fixed in latest CVS. Thanks Renanse.

Great!  :)  No prob.