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
A voir également:
Java.rmi.unmarshalexception
Java.rmi.unmarshalexception: error unmarshalling return; nested exception is: - Meilleures réponses
Java.rmi.unmarshalexception: unrecognized method hash: method not supported by remote object - Meilleures réponses
"Les interfaces sont bien du coté serveur et du coté client." Il faut que ce soit exactement la même, pas juste un copier-coller, parce qu'il y a des informations dans la classe compilée qui doivent être identique des deux côtés sinon tu auras d'autres erreurs.
Avec un jar c'est pratique de partager du code, surtout si tu as une gestion des dépendances, par exemple avec Maven, où le jar est centralisé dans un dépôt de code commun et donc accessible à l'identique par n'importe quel programme qui en a besoin.