[Date Prev][Date Next] [Chronological] [Thread] [Top]

java object serialization error



Hi

I've been trying to serialize large java objects but I seem to be hitting a problem I can't resolve. I can easily serialize the object and bind it to the server. When I get to the point of reading/lookup and deserializing the object, something goes wrong just as the deserialization is passing through the first 1k boundry.

Ie: my object consists of a number of byte arrays. During serialization with:

ldapSupport.bind("dc=manager,dc=example,dc=com" , "cn=topManager", manager);

.. I observe the byte arrays being serialized - and they are all serialized - with ..


size =80 size =48 size =48 size =48 size =256 size =256 size =27 size =65 size =65 size =64 size =64 size =64 size =128 size =129 size =129 size =1649 size =1104 size =65 size =65 size =64 size =64 size =65 size =129 size =129 size =3 size =1646 size =1101


..... and during the deserialzation with :

manager = (Manager)ldapSupport.lookup("dc=manager,dc=example,dc=com" , "cn=topManager");

.. I get the following sized byte arrays read in and then an exception when the 1k boundary is reached ....

Size =80
Size =48
Size =48
Size =48
Size =256
Size =256
Size =27
Size =65
Size =65
Size =64
Size =65
Size =-1744521466
Manager doesn't exist - java.lang.NegativeArraySizeException
java.lang.NegativeArraySizeException
at com.syntactics.admin.common.account.Manager.loadByteArray(Manager.java:348)
at com.syntactics.admin.common.account.Manager.readObject(Manager.java:381)
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:324)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at com.sun.jndi.ldap.Obj.deserializeObject(Obj.java:511)
at com.sun.jndi.ldap.Obj.decodeObject(Obj.java:217)
at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:963)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.java:522)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:155)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:347)



Note that the serialized object begins with a long value and then every byte array is preceded by an integer specifying the length of the array.


Is this a bug, limitation or goofup on my part?

Cheers
buzz

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger