0

我正在做一个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 是串行的....但在我的情况下并没有发生

4

1 回答 1

2

发生了同样的问题......当我试图通过 RMI 传递 ImageIcon 对象时......

经过长时间的检查......我发现我指定的网址不正确......

它发生了......这里的编译器经常像你展示的那样显示 Unmarshall 异常......

尝试检查您的本地 URL .....

于 2012-06-20T16:32:29.333 回答