Olá pessoal !
Eu criei um servidor e um cliente RMI.Quando rodo eles pelo eclipse funciona tudo blz, porém quando gero o .jars e vou até a linha de comando apenas o servidor funciona e quando tento conectar o cliente com meu servidor , é lançado a seguinte excessão :
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.client.Cliente.main(Cliente.java:19)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(Unknown Source)
... 4 more
Configurei meu arquivo rmi.policy :
grant {
permission java.security.AllPermission;
};
Não sei por isso acontece. Alguém pode me ajudar ?
SERVIDOR
try{
MinipulaImpl objRemoto = new MinipulaImpl();
Manipula stub = (Manipula) UnicastRemoteObject.exportObject(objRemoto,1000);
Registry registry = LocateRegistry.createRegistry(1000);
if(System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
registry.bind("SERVIDOR",stub);
System.out.println("Servidor Ligado ...");
}
try {
Registry registry = LocateRegistry.getRegistry("localhost",1000);
stub = (Manipula) registry.lookup("SERVIDOR");
System.out.println(stub.seleciona("Pessoa"));
}
