锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲午夜,精华区一区二区三区,亚洲h在线观看http://www.aygfsteel.com/feuyeux/category/48716.htmlBelong to Eric Hanzh-cnWed, 25 Apr 2012 20:52:02 GMTWed, 25 Apr 2012 20:52:02 GMT60Java榪滅▼鏂規(guī)硶璋冪敤瀹炶返 http://www.aygfsteel.com/feuyeux/archive/2011/05/26/RMI.htmlLu HanLu HanThu, 26 May 2011 15:55:00 GMThttp://www.aygfsteel.com/feuyeux/archive/2011/05/26/RMI.htmlhttp://www.aygfsteel.com/feuyeux/comments/351136.htmlhttp://www.aygfsteel.com/feuyeux/archive/2011/05/26/RMI.html#Feedback1http://www.aygfsteel.com/feuyeux/comments/commentRss/351136.htmlhttp://www.aygfsteel.com/feuyeux/services/trackbacks/351136.html鏈嶅姟鍣ㄧ涓氬姟鎺ュ彛緇ф壙鑷猂emote
public interface Biz extends Remote {
public String aloha() throws RemoteException;
}

鏈嶅姟鍣ㄧ涓氬姟瀹炵幇璇ユ帴鍙?/div>
public class BizImpl extends UnicastRemoteObject implements Biz {
private static final long serialVersionUID = -8559392326593037120L;
public BizImpl() throws RemoteException {
super();
}
@Override
public String aloha() throws RemoteException {
return "Aloha Baby.";
}
}

鏈嶅姟鍣ㄦ敞鍐岃繙紼嬪疄鐜板悕縐?br />
public class Server {
public Server() {
try {
Biz bis = new BizImpl();
// style-1
Registry registry = LocateRegistry.createRegistry(RMIParameter.PORT);
registry.rebind(RMIParameter.NAME, bis); // replace existing binding name
// style-2
//java.rmi.Naming.rebind(RMIParameter.NAME, bis); // replace existing binding name
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
new Server();
}
}

style-2 闇瑕佹寚瀹氫竴涓狿olicy鏂囦歡鎴栬呰繍琛宺miregistry
java -Djava.security.policy=folder_x/rmi/policy_file creative.fire.rmi.Server
Policy鏂囦歡鐨勫唴瀹逛負(fù)錛?/div>
grant{
      permission java.net.SocketPermission "localhost:9527", "connect, resolve";
};
榪愯rmiregistry鏄慨鏀?JDK 鐩綍涓嬬殑jre/lib/security/java.policy
rmiregistry錛坙inux錛?/div>
start rmiregistry(windows)
鍏佽浠諱綍浜?targets)浣滀換浣曚簨鎯?actions)錛?/div>
grant{
        permission java.security.AllPermission "","";
};
OR
grant {
  permission java.security.AllPermission;
};
瀹㈡埛绔墦妗╄皟鐢?br />
public class Client {
public static void main(String args[]) {
try {
Biz bis = (Biz) Naming.lookup(RMIPREFIX + PORT + NAME);
System.out.println(bis.aloha());
} catch (Exception e) {
e.printStackTrace();
}
}
}


Lu Han 2011-05-26 23:55 鍙戣〃璇勮
]]> 主站蜘蛛池模板: 新田县| 宁阳县| 洛宁县| 潢川县| 桐梓县| 高阳县| 新蔡县| 宜丰县| 闸北区| 昆明市| 宜城市| 松阳县| 大荔县| 怀化市| 四会市| 治多县| 五指山市| 营山县| 罗山县| 桂东县| 封丘县| 拜泉县| 民权县| 梁平县| 南阳市| 嘉善县| 禄劝| 宁都县| 邢台县| 环江| 涞水县| 新宾| 荣成市| 会泽县| 乌苏市| 大同县| 石河子市| 石台县| 茶陵县| 日土县| 罗源县|