2 oppalu oppalu 于 2016.02.18 13:37 提问

java rmi连接本机问题

代码如下,然后就运行不出来Naming.rebind之后的那句sysout。也没有异常就是不运行,等了好几分钟还是运行不出来

try {
System.out.println("start active server...");
FinanceAccountDataService financeAccountDataService = new FinanceAccountDataImpl();
FinanceReportDataService financeReportDataService = new FinanceReportDataImpl();
FinanceSalaryDataService financeSalaryDataService = new FinanceSalaryDataImpl();
MealDataService mealDataService = new MealDataImpl();
MemberDataService memberDataService=new MemberDataImpl();
PersonnelDataService personnelDataService = new PersonnelDataImpl();
ProcessOrderDataService processOrderDataService = new ProcessOrderDataImpl();
UserDataService userDataService = new UserDataImpl();
WarehouseDataService warehouseDataService = new WarehouseDataImpl();

        LocateRegistry.createRegistry(6600);

        System.out.println("start register services...");
        Naming.rebind("rmi://localhost:6600/FinanceAccountDataService", financeAccountDataService);
        Naming.rebind("rmi://localhost:6600/FinanceReportDataService", financeReportDataService);
        Naming.rebind("rmi://localhost:6600/FinanceSalaryDataService", financeSalaryDataService);
        Naming.rebind("rmi://localhost:6600/MealDataService", mealDataService);
        Naming.rebind("rmi://localhost:6600/MemberDataService", memberDataService);
        Naming.rebind("rmi://localhost:6600/PersonnelDataService", personnelDataService);
        Naming.rebind("rmi://localhost:6600/ProcessOrderDataService", processOrderDataService);
        Naming.rebind("rmi://localhost:6600/UserDataService", userDataService);
        Naming.rebind("rmi://localhost:6600/WarehouseDataService", warehouseDataService);

        System.out.println("active server successfully!");
    } catch (Exception e) {
        System.out.println("fail to active server!");
        e.printStackTrace();
    }

1个回答

devmiao
devmiao   Ds   Rxr 2016.02.18 22:00
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!