[RMI] ClassNotFoundException que je ne comprends tjs pas
J'avais déjà fait un post à ce sujet mais après différents tests, je ne comprends toujours pas alors je viens poster de nouveau en mettant quelques précisions :
J'ai fait un test avec le strict minimum que voici :
Tous mes fichiers sont dans le default package.
J'ai une classe Balle (j'ai pris ce nom au hasard) dans Balle.java:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| public class Balle extends UnicastRemoteObject implements IBalle{
protected Balle() throws RemoteException {
super();
}
int i;
public void setI(int i) throws RemoteException {
this.i=i;
}
public int getI() throws RemoteException {
return i;
}
} |
l'interface implémentée est la suivante : IBalle.java :
Code:
1 2 3 4
| public interface IBalle extends Remote {
public void setI(int i) throws RemoteException;
public int getI() throws RemoteException;
} |
Et une classe pour tester que voici (Test.java) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| public class Test {
public static void main(String[] args) {
try {
IBalle b = new Balle();
Naming.rebind("huhu",b);
IBalle bb = (IBalle) Naming.lookup("//127.0.0.1/huhu");
} catch (RemoteException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (NotBoundException e) {
e.printStackTrace();
}
}
} |
Je compile, je fais mon rmic Balle, les skel et stubs sont bien générés, je lance rmiregistry, tout est ok.
Mais lorsque je lance, j'ai l'exception suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Balle_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at 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 Test.main(Test.java:24) |
On m'a suggéré d'utiliser codebase, ce que j'ai fait de la façon suivante (le chemin est bon) :
Code:
java -Djava.rmi.server.codebase=file:/C:\eclipse\workspaces\perso\teste Test
mais toujours là même exception.
voilà, tout les éléments sont là. Je sèche totalement depuis hier. Je béni celui qui trouvera le problème ;)
merci.
Satch