Hi,
This is what I am trying to do and not able to get a solution.
public interface X extends Remote {
public void methodOne() throws RemoteException;
public Z methodTwo() throws RemoteException; //Z is a class
}
public class XImpl implements X {
public void methodOne() throws RemoteException {
// body
}
public Z methodTwo() throws RemoteException {
//body
return new Z();
}
}
public class MyServer {
public MyServer(){
X x=(X)new XImpl();
UnicastRemoteObject.exportObject(x);
Naming.rebind("rmi://localhost:1099/MyServer", x);
}
public static void main(
String s[]) {
new MyServer();
}
}
Now when I call the methodOne from the client, it works fine but if I try to call methodTwo, the return type is null.
I tried creating an interface for Z(say ZInter) and made Z implement the interface ZInter and created the stub and the skeleton classes. But now, I do not know how do I refer them in the client.
Please reply ASAP.