我在做一个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是串行的,但在我的情况下不会发生