java.rmi.UnmarshalException: 解组参数错误;嵌套异常是:java.lang.ClassNotFoundException: ServicesTableau [英] java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: ServicesTableau

查看:52
本文介绍了java.rmi.UnmarshalException: 解组参数错误;嵌套异常是:java.lang.ClassNotFoundException: ServicesTableau的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要您在 JAVA RMI 方面的帮助,我开发了一个用于对表格进行排序的示例程序.但我得到了这个例外:

I need your help around JAVA RMI, i developped a sample program used to sort 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 my Server source code :

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 中不可用.修复它的最简单方法是通过 LocateRegistry.createRegistry() 在同一个 JVM 中启动 Registry. 将结果存储在静态字段中.

That class isn't available on the CLASSPATH of the RMI Registry. The simplest way to fix it is to start the Registry in the same JVM, via LocateRegistry.createRegistry(). Store the result in a static field.

这篇关于java.rmi.UnmarshalException: 解组参数错误;嵌套异常是:java.lang.ClassNotFoundException: ServicesTableau的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆