RMI ne trouve pas l'interface

paesportcomputing - 7 avril 2017 à 21:43
KX Messages postés 16733 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 31 janvier 2024 - 8 avril 2017 à 12:36
Bonjour,

J'essaye de tester la technologie RMI mais je coince sur un problème. Le serveur démarre mais pas le client.
Voici ma stacktrace :

java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: rmiServer.IInformation
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at rmiClient.LaunchRmiClient.init(LaunchRmiClient.java:53)
at rmiClient.LaunchRmiClient.<init>(LaunchRmiClient.java:23)
at launcher.Starter.start(Starter.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: rmiServer.IInformation
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)



rmiServer est mon package où se situent les classes RMI du serveur.
IInformation est mon interface qui extends Remote (coté serveur)

D'après mes recherches, il s'agirait d'un problème de CLASSPATH. Mais je ne parviens pas à résoudre le problème (je développe avec NetBeans).
Quelqu'un pourrait m'aider ?

Merci

2 réponses

KX Messages postés 16733 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 31 janvier 2024 127
7 avril 2017 à 22:04
Bonjour,

L'interface IInformation qui est côté serveur doit aussi être côté client pour pouvoir faire le lien sur le contrat d'implémentation.

Tu peux par exemple faire un jar commun qui ne contient que les interfaces et ajouter ce jar au classpath du client et du serveur.
0