HelloRMIServer无法在bind()中连接

时间:2017-10-10 02:04:11

标签: java rmi

做一个课程,我试图围绕RMI。我似乎无法做对。链接到未修改的源代码:https://drive.google.com/open?id=0B7NQABLlsgGWbXNhb0JHall4NXM

package helloworld;

import java.rmi.Naming;

public class HelloRMIServer {

// TODO 08. Set the OBJECT_NAME to the same value used by the client.
private static String OBJECT_NAME = "TEST";

public static void main(String[] args) {
    try {
        // TODO 09. Create a new instance of the remote object.
        MessageInterface message = new MessageInterface();
        // TODO 10. Re-bind the object in the registry.
        Naming.rebind("rmi://" + "127.0.0.1" + "/" + OBJECT_NAME, message);
        System.out.println("Server object message bound into registry.");
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println("Server done creating and binding objects.");
    }
}

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您尚未启动namespace :deploy do desc 'Fix repo origin, for use when changing git repo URLs' task :fix_repo_origin do on roles(:web) do within repo_path do execute(:git, "remote set-url origin #{repo_url}") end end end end