错误:加载school.School.server.policy时无法找到或加载主类错误

时间:2016-06-25 04:32:06

标签: java eclipse rmi

错误:找不到或加载主类school.School.server.policy 我的rmi服务器在运行时发出此错误我正在使用eclipse

VM参数是这些

-Djava.security.manager 
-Djava.security.policy=${workspace_loc}/School/server.policy
-Djava.rmi.server.codebase=file:${workspace_loc}/School/bin/

服务器代码

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;


public class SchoolSever { 
    public static void main (String[] args){
    if (System.getSecurityManager() == null){
        System.setSecurityManager(new SecurityManager());
    }
    try{
        String name = "School";
        SchoolInterfaceImpl sii = new SchoolInterfaceImpl();
        SchoolInterface stub =
                (SchoolInterface ) UnicastRemoteObject.exportObject(sii, 0);
        Registry registry = LocateRegistry.getRegistry();
        registry.rebind(name, stub);
    }
    catch (Exception e){
        System.err.print("Server not running: " );
    e.printStackTrace();
    }
}
}

服务器政策

grant {
permission java.security.AllPermission;
};

enter image description here

0 个答案:

没有答案