作者NightPrince (shooting star)
看板java
標題Re: [問題] RMI
時間Sat Mar 18 15:24:27 2006
※ 引述《NightPrince (shooting star)》之銘言:
: 我寫了一個簡單的RMI程式,
: 部分程式碼如下:
: LocateRegistry.createRegistry(1099);//啟動registry server
: String serverObject = "rmi://localhost/serverObject";
: Naming.rebind(serverObject,temp);
: 在rmi://那,我如果寫localhost就沒問題
: 寫 domain name 就會有問題,我LAB的DN是 blue.iim.ncku.edu.tw
: 也就是 rmi://blue.iim.ncku.edu.tw/serverObject
: LAB只有一個public IP Addr. ,所以LAB所有的電腦都是使用
: Class C private IP Addr. 然後透過那個 public IP Addr. 連上網路
: 以往,我要用我電腦架站,只要去 IP 分享器設定我這個 private IP Addr.
: 要用那個PORT架設,就把那個port對應到我這個 private IP Addr. 即可
: 1099 port 我已經設定對應到我這個 private IP Addr. ,結果打上DN
: 就無法運作,不知我哪裡出了問題?
順便附上錯誤訊息 XD
Exception in thread "main" java.rmi.ServerException: RemoteException occurred
in server thread; nested exception is:
java.rmi.AccessException: Registry.Registry.rebind disallowed; origin
/140.116.96.181 is non-local host
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at songServerImpl.main(songServerImpl.java:67)
Caused by: java.rmi.AccessException: Registry.Registry.rebind disallowed;
origin /140.116.96.181 is non-local host
at sun.rmi.registry.RegistryImpl.checkAccess(Unknown Source)
at sun.rmi.registry.RegistryImpl.rebind(Unknown Source)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.96.181