java.rmi.UnmarshalException:错误解组参数; 嵌套异常是:java.lang.ClassNotFoundException:ServicesTableau

MDI*_*DIT 9 java rmi

我需要你对JAVA RMI的帮助,我开发了一个用于排序表的示例程序.但我有这个例外:

Erreur RemoteException occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: ServicesTableau
Run Code Online (Sandbox Code Playgroud)

这是我的服务器源代码:

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);
    }
    */
    }
}
Run Code Online (Sandbox Code Playgroud)

use*_*421 14

该类在RMI注册表的CLASSPATH上不可用.解决它的最简单方法是通过LocateRegistry.createRegistry().将结果存储在静态字段中,在同一个JVM中启动Registry .


小智 6

这发生在我身上,因为我没有rmiregistry在与服务器相同的目录中运行。