ObjectEncoder Decoder fails with Object containing Object[]

neilson9 neil at liquidlabs.co.uk
Tue Jun 23 02:56:39 EDT 2009


Hi All,
Firstly, thankyou for developing this framework - Ive have used quite a few
in the past and netty is easy to use, has a great API and extremely fast!

I have 2 questions,
1) Does an Object passes using the ObjectEncoder/Decoder have to implement
Serializable? - is there a switch to disable the check?

2) Ive just been looking at passing through messages using the
ObjectDecoder, ObjectEncoder and have found that if any message contains an
field Object[] i.e. below. Is there something Im missing ? Im trying to
proxy a data payload to the server without having to use other forms of
serialization.

class MyClass {
Object[] stuff 
}

then it fails with the following message.
java.io.InvalidClassException: failed to read class descriptor
	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1567)
	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
	at
org.jboss.netty.handler.codec.serialization.ObjectDecoder.decode(ObjectDecoder.java:117)
	at
org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:244)
	at
org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:184)
	at
org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:87)
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:344)
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:331)
	at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:303)
	at
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:255)
	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:176)
	at
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:49)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.ClassNotFoundException: [Ljava.lang.Object;
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
	at
org.jboss.netty.handler.codec.serialization.CompactObjectInputStream.loadClass(CompactObjectInputStream.java:100)
	at
org.jboss.netty.handler.codec.serialization.CompactObjectInputStream.readClassDescriptor(CompactObjectInputStream.java:74)
	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1565)
	... 21 more


Many Thanks,
-Neil.
-- 
View this message in context: http://n2.nabble.com/ObjectEncoder-Decoder-fails-with-Object-containing-Object---tp3140774p3140774.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list