想问一个有关rmi测试的问题,困扰我多时了:
我有一个远程接口HelloService同时我有2个实现了此接口并接继承UnicastRemoteObject的类HelloServiceImpl1,HelloServiceImpl2
然后在服务器段测试下代码:
HelloServiceImpl1 helloService1=new HelloServiceImpl1();
                        HelloServiceImpl2 helloService2=new HelloServiceImpl2();
                        Context namingContext=new InitialContext(); 
                        namingContext.rebind("rmi://localhost:1099/helloService1", helloService1);
                        namingContext.rebind("rmi://localhost:1099/helloService2", helloService2);
                        System.out.println("服务器注册了2个HelloService对象");
报错:
javax.naming.ServiceUnavailableException :Connection refused to host: localhost;
不知什么原因,请前辈指教!
答案越详细越好,不要照书抄!谢谢!