我使用的是netty 3.2.7。 当我从客户端向同一台计算机上的服务器发送消息(包含在DAOMessage中)时,它可以正常工作。
如果我做的完全相同,但客户端和服务器在不同的计算机上,我会得到以下异常。服务器抱怨它无法找到DAOMessage。当然,它所需要的只是它在通道/管道中传递给它的参考。
有谁知道如何解决这个问题?
31-Dec-2011 12:59:17 org.jboss.netty.server.SecureServerHandler exceptionCaught
WARNING: Unexpected exception from downstream.
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.readOrdinaryObject(ObjectInputStream.java:1732)
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:129)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:321)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202)
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:619)
Caused by: java.lang.ClassNotFoundException: org.acm.domain.DAOMessage
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.jboss.netty.handler.codec.serialization.ClassLoaderClassResolver.resolve(ClassLoaderClassResolver.java:35)
at org.jboss.netty.handler.codec.serialization.CachingClassResolver.resolve(CachingClassResolver.java:43)
at org.jboss.netty.handler.codec.serialization.CompactObjectInputStream.readClassDescriptor(CompactObjectInputStream.java:62)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1565)
... 19 more
31-Dec-2011 12:59:17 org.jboss.netty.server.SecureServerHandler handleUpstream
INFO: [id: 0x013936e1, /127.0.0.1:49318 :> /127.0.0.1:1234] DISCONNECTED
31-Dec-2011 12:59:17 org.jboss.netty.server.SecureServerHandler handleUpstream
INFO: [id: 0x013936e1, /127.0.0.1:49318 :> /127.0.0.1:1234] UNBOUND
31-Dec-2011 12:59:17 org.jboss.netty.server.SecureServerHandler handleUpstream
INFO: [id: 0x013936e1, /127.0.0.1:49318 :> /127.0.0.1:1234] CLOSED