I have a problem in executing a rmi program can someone help me ...
This is my remote interface ..
package mypack;
import java.rmi.*;
public interface UHello extends Remote {
public String getMessage() throws RemoteException;
}
This is my Server ...
ackage mypack;
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
public class UHelloServer extends UnicastRemoteObject implements UHello
{
String msg;
public UHelloServer(String Msg) throws RemoteException{
msg=Msg;
}
public String getMessage(){
return msg;
}
public static void main(String args[]) throws Exception {
UHelloServer server;
String str;
//LocateRegistry.createRegistry(10);
server = new UHelloServer("Rmi server message how are you buddy");
Naming.rebind("UHelloServer",server);
System.out.println("Ready for RMI Clients");
}
}
This my Client..ackage mypack;
import java.rmi.*;
public class UHelloClient {
public static void main(String args[]) throws Exception
{
UHello client;
String str;
client =(UHello)Naming.lookup("UHelloServer");
str=client.getMessage();
System.out.println(" The message from server is :"+ str);
}
}
I compile UHello , UHelloServer & UHelloClient .. then do rmic on server
class .. stubs & skel are generated properly ..
I am running both the client & the server in the same machine(Win 2K) , I
start the registry first and then if start the server it says port already
bound .. so I stop the registry & then start the server now the server runs
..
When i start the client it spits exception..
java.net.ConnectException ....
etc
Can someone please help , do i miss something stupid .. Thanks
Suresh
_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm