简体   繁体   English

java rmi传递ImageIcon对象

[英]java rmi passing ImageIcon objects

I m making an rmi client server based program which is suppose to pass Image object through remote object interfaces . 我正在制作一个rmi client server based program ,它假设pass Image object through remote object interfaces The Client receives an Image from the Server . 客户端从服务器接收图像

Following is my code.... 以下是我的代码......

At Client 在客户端

       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 is an interfacing method implemented... sendImage是一个实现的接口方法...

        public ImageIcon getImageFromServer() throws RemoteException;

At Server 在服务器上

           public ImageIcon getImageFromServer()
           {
                  ImageIcon ic = new ImageIcon("local url specified");
                  return ic;
           }

         // Much of the Exceptions and other binding details are excluded for simpicity.....

Now the problem is, im getting an error called 现在的问题是,我得到一个错误调用

          java.rmi.UnmarshalException: error unmarshalling return
          nested exception is: java.io.EOFException               

Now, Actually i don't have much of any idea how it came... The two major doubts I have is.... 现在,实际上我并不知道它是怎么来的......我的两个主要疑点是....

Is it possible to send ImageIcon objects through rmi...?? 是否可以通过rmi发送ImageIcon对象... ?? If yes, What could be probably the mistake here. 如果是的话,这可能是错误。 If not, does there exist any simple way to pass Image based objects as parameter through rmi...?? 如果没有,是否存在任何简单的方法将基于图像的对象作为参数传递给rmi ... ??

I've also heard somewhere that javax.swing.ImageIcon is serial....but it's not happening in my case 我也听说过某个地方javax.swing.ImageIcon是串行的....但是我的情况并没有发生

The same problem occured...when i tried to pass ImageIcon object through RMI.... 发生同样的问题...当我试图通过RMI传递ImageIcon对象....

After a long checking....i found the url i specifed was incorrect..... 经过长时间的检查....我发现我指定的网址不正确.....

it happens...the complier in this often shows Unmarshall exception exactly as you shown....... 它发生了...这个编译器经常显示Unmarshall异常完全如你所示.......

try checking your local URL..... 尝试检查您的本地URL .....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM