When i am working with Rmi “Hello world” program without Stub and skeleton the program has been working .
This is remote interface
import java.rmi.*;
public interface SmallInter extends Remote {
public String getMesg(String s) throws RemoteException;
}
This is my server side program
import java.rmi.*;
import java.rmi.server.*;
public class SmallServer extends UnicastRemoteObject implements SmallInter
//to convert local object into remote object
{
public SmallServer() throws RemoteException {
}
public String getMesg(String s) throws RemoteException {
String s1 = “This is a message from server after a message” + s;
return s1;
}
public static void main(String arg[]) {
try {
SmallServer ser = new SmallServer();
Naming.rebind(”small”, ser);
System.out.println(”server ready”);
} catch (Exception e) {
e.printStackTrace();
}
}
}
This is my Client side code:
import java.rmi.*;
public class SmallClient {
public static void main(String arg[]) {
try {
SmallInter remobj=(SmallInter)Naming.lookup(”rmi://”+arg[0] +”/small”);
System.out.println(remobj.getClass());
String res = remobj.getMesg(”from client”);
System.out.println(res);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
but when printing the remobj.getClass() it will retuen some “class $proxy”
How this is possible?
please give me the answer………..
260 Views |
No comments yet.