Pessoal,
Estou tentando rodar o simples servidor de RMI abaixo.
[code]public class ServidorImpl extends UnicastRemoteObject implements Servidor {
public ServidorImpl() throws RemoteException { super(); }
public int getX() throws RemoteException{
return 5;
}
public static void main(String[] args) throws Exception {
System.out.println("Inicializando...");
ServidorImpl serv = new ServidorImpl();
String servName = "//localhost/Servidor";
Naming.rebind(servName, serv);
}
}
[/code]
Já inicializei o rmiregistry, já criei o stub, mas quando vou rodar, aparece a exceção:
[size=“6”][color=“darkblue”]
Exception in thread “main” java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: servidorRMI2.ServidorImpl_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
(…)
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at servidorRMI2.ServidorImpl.main(ServidorImpl.java:24)[/size][/color]
Ok. Pelo visto ele não está encontrando o stub. Alguém conseque identificar o problema?