java rmi传递ImageIcon对象 [英] java rmi passing ImageIcon objects

查看:86
本文介绍了java rmi传递ImageIcon对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作基于 rmi客户端服务器的程序,假设通过远程对象接口传递Image对象客户端从服务器接收图像

I m making an rmi client server based program which is suppose to pass Image object through remote object interfaces. The Client receives an Image from the Server.

以下是我的代码....

Following is my code....

在客户

       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是一种实现的接口方法...

sendImage is an interfacing method implemented...

        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.....

现在的问题是,我得到一个名为

Now the problem is, i m 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....

是否可以通过rmi发送ImageIcon对象... ??如果是的话,这可能是错误。如果没有,是否存在通过rmi将基于图像的对象作为参数传递的简单方法... ??

Is it possible to send ImageIcon objects through rmi...?? 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...??

I还听说javax.swing.ImageIcon是串行的......但是我的情况并没有发生

推荐答案

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

The same problem occured...when i tried to pass ImageIcon object through RMI....

经过长时间的检查......我找到了网址我指定是不正确的.....

After a long checking....i found the url i specifed was incorrect.....

它发生了...这个编译器经常显示Unmarshall异常,正如你所示.......

it happens...the complier in this often shows Unmarshall exception exactly as you shown.......

尝试检查您的本地网址.....

try checking your local URL.....

这篇关于java rmi传递ImageIcon对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆