我正在做一个rmi client server based program假设pass Image object through remote object interfaces。客户端从服务器接收图像。
以下是我的代码....
在客户端
       public class ImageReceiver
       {
                  public static ImageIcon imageicon;
                  public static void main(String Data[])
                  {
                         imageicon = new ImageIcon(url);
                         imageicon=remoteObject.getImageFromServer();
                  }
        }
        // The Details regarding the binding of remote objects are excluded since they are worling fine...
sendImage 是一个实现的接口方法......
        public ImageIcon getImageFromServer() throws RemoteException;
在服务器
           public ImageIcon getImageFromServer()
           {
                  ImageIcon ic = new ImageIcon("local url specified");
                  return ic;
           }
         // Much of the Exceptions and other binding details are excluded for simpicity.....
现在的问题是,我收到一个名为
          java.rmi.UnmarshalException: error unmarshalling return
          nested exception is: java.io.EOFException               
现在,实际上我不知道它是怎么来的……我的两个主要疑问是……
是否可以通过 rmi 发送 ImageIcon 对象...??如果是的话,这里可能是什么错误。如果没有,是否存在任何简单的方法来通过 rmi 将基于图像的对象作为参数传递......??
我还在某处听说 javax.swing.ImageIcon 是串行的....但在我的情况下并没有发生