Problème Server RMI avec JAVA

[Fermé]
Signaler
-
Messages postés
2
Date d'inscription
mercredi 19 décembre 2012
Statut
Membre
Dernière intervention
19 décembre 2012
-
Bonjour,

Je suis actuellement en train de faire un projet sous eclipse avec ServerRMI je me suis fait un .bat qui permet de lancer le rmiregistry.exe qui suis :

start rmiregistry
java ServerRMI
pause

et quand je lance ma classe ServerRMI qui est :

import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
import java.net.*;

public class ServerRMI {


static public void main(String args[]) {
try {
Naming.rebind("rmiServer", new RequestPDS());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}



Il me sort l'erreur :

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: InterfaceRMI
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at ServerRMI.main(ServerRMI.java:13)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: InterfaceRMI
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: InterfaceRMI
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 12 more


Quelqu'un aurais une idées ?

Merci d'avance :)

3 réponses

Help please :)
Messages postés
2
Date d'inscription
mercredi 19 décembre 2012
Statut
Membre
Dernière intervention
19 décembre 2012

il te faut revoir tes déclaratipons
Messages postés
2
Date d'inscription
mercredi 19 décembre 2012
Statut
Membre
Dernière intervention
19 décembre 2012

voici les déclarations nécessaires
pour ta classe serveur :

import java.rmi.*;
import java.rmi.registry.*;
import java.io.*;

public class ServerRMI extends UnicastRemoteObject implements TonInterface { //ton code}

pour ta classe Client:

import java.rmi.*;
import java.rmi.registry.*;
import java.io.*;

public class TaClasseClient implements Serializable {//ton code}


et pour ton interfaface

public interface TonInterface extends Remote
{
public typeDeRetour taMethodeDistante(Déclaration de parametres) throws RemoteException;
}