Java RMI?????????????
???????????? ???????[ 2013/1/15 10:54:19 ] ????????
??????????д????????
???????? main ???????????????????????????????????????????????HelloServer??????????????????????????java.rmi.registry.LocateRegistry???createRegistry ???????????????????????????????????? rmiregistry ???????????????????????????????ж??? 1099???????????????????????????????????Naming.rebind("//localhost??8808/SAMPLE-SERVER" ?? Server)??
????????????????????????
/**
* User: jiangzhenfei
* Date: 2012-8-7 22:03:35
* ????RMI????????RMI?????????????????RMI?????С?
*/
public class HelloServer {
public static void main(String args[]) {
try {
//?????????????
IHello rhello = new HelloImpl();
//?????????????????????Registry????????????????8888???????????????Java???????1099?????????????????????????????????????????????????
LocateRegistry.createRegistry(8888);
//???????????RMI??????????????????RHello
//????URL?????????rmi://host:port/name(????Э????????????????????д????????????
Naming.bind("rmi://localhost:8888/RHello"??rhello);
// Naming.bind("//localhost:8888/RHello"??rhello);
System.out.println(">>>>>INFO:???IHello??????????");
} catch (RemoteException e) {
System.out.println("????????????????");
e.printStackTrace();
} catch (AlreadyBoundException e) {
System.out.println("?????????????????");
e.printStackTrace();
} catch (MalformedURLException e) {
System.out.println("????URL????????");
e.printStackTrace();
}
}
}
?????????д????????????????
???????????????????????????
??????????Naming.lookup??????????????????? stub ?????????
??????????÷??????????????????????
????????????????????????
/**
* User: jiangzhenfei
* Date: 20128-8-7 22:21:07
* ?????????????????????????????????????????????
*/
public class HelloClient {
public static void main(String args[]){
try {
//??RMI?????????в????????RHello???????????????????
IHello rhello =(IHello) Naming.lookup("rmi://localhost:8888/RHello");
System.out.println(rhello.helloWorld());
System.out.println(rhello.sayHelloToSomeBody("????"));
} catch (NotBoundException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
?????塢???????
????????? Java ???????????? javac ????
????????RMI????????
????javac HelloServer.java
????????RMI????????
????javac HelloClient
???????
????????????????????RMI?????????IP?????????????????????????????????????????????IP??????Σ???????????????????IP?????
?????????RMI?????????????????????????????????????DNS???????????????????IP???????????????
????RMI????????????RMI??Java?????????????????????????????Java???????????????????????????Web Service??????????????????????CORBA????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11