Java.rmi.UnmarshalException: erroneous arguments; Nested Exception: java.lang.ClassNotFoundException: ServicesTableau

I need your help around JAVA RMI, I developed an example program used to sort the table. but I got this exception:

Erreur RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: ServicesTableau 

and this is the source code of my server:

 public class Serveur { public static void main(String args[]) { try { System.out.println("Server start ..."); ServicesTableauImpl od = new ServicesTableauImpl(); String url = "rmi://" + args[0] + "/ServicesTableauImpl"; System.out.println("Passe"); Naming.rebind(url, od); System.out.println("Attente d'invocations de client / CTRL-C pour stopper"); } catch (Exception e) { System.out.println("Erreur " + e.getMessage()); } /* catch(java.net.MalformatedURLException e){ System.out.println("Mauvais nom de serveur"); System.exit(1); } catch(RemoteException e){ System.out.println("Pas de Rmiregistry"); System.exit(1); } */ } } 
+7
source share
3 answers

This class is not available in the CLASSPATH RMI registry. The easiest way to fix this is to run the registry in the same JVM, through LocateRegistry.createRegistry(). save the result in a static field.

+10
source

In some cases, you need to move the rmi client code (interface and main) to the default package. Repeat this for the server side. It can solve your problem (working with packaging in rmi is not so obvious).

0
source

This error occurs due to the absence of the Security Manager code, due to which the class cannot load. So make sure you add the code for the security manager.
If the compiler does not find a security manager, then create a new one. Add the code to the main method.

 if (System.getSecurityManager() == null) then System.setSecurityManager(new RMISecurityManager()) 
-2
source

All Articles