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

2023-12-29

我需要你关于 JAVA RMI 的帮助,我开发了一个用于对表进行排序的简单程序。但我得到了这个例外:

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

这是我的服务器源代码:

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);
    }
    */
    }
}

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

java.rmi.UnmarshalException:解组参数时出错;嵌套异常是:java.lang.ClassNotFoundException:ServicesTableau 的相关文章

随机推荐