Alguem sabe que erro é esse quando eu executo meu programa que implementa o rmi?
Trouble: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: HelloImpl_Stub
O programa é esse:
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.*;
import javax.swing.*;
/**
*
* @author halisson.duraes
*/
public interface Hello extends Remote {
void retorna(String s) throws RemoteException;
}
class HelloImpl extends UnicastRemoteObject implements Hello{
public HelloImpl() throws RemoteException{}
public void retorna(String s) throws RemoteException{
JOptionPane.showMessageDialog(null,s);
}
}
class HelloServer{
public static void main(String[] args) {
try{
String name="teste";
HelloImpl hi=new HelloImpl();
Registry r = LocateRegistry.getRegistry();
r.bind(name , hi);
}catch(UnmarshalException ume){
System.out.println(ume);
}catch(Exception e){
System.out.println(e);
}
}
}
class HelloClient{
public static void main(String[] args) {
try{
Remote remRef = Naming.lookup("rmi://localhost:1099/teste");
Hello h=(Hello) remRef;
String s=JOptionPane.showInputDialog(null,"Digite:");
h.retorna(s);
}catch(UnmarshalException ume){
System.out.println(ume);
}catch(Exception e){
System.out.println(e);
}
System.exit(0);
}
}