Java RMI を使用してクライアント/サーバー プログラムを作成していますが、次のエラーが発生します。
java.security.AccessControlException: アクセスが拒否されました ("java.net.SocketPermission" "127.0.0.1:1099" "接続、解決")
私のコードは次のようになります。
package xxx;
import java.rmi.Naming;
import java.rmi.RemoteException;
public class Server extends Engine implements RemoteInterface {
public Server() {
super();
if(System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
try {
Naming.rebind("Test", this);
System.out.println("Bound in registry!");
} catch(Exception ex) {
System.out.println(ex);
}
}
@Override
public void test() throws RemoteException {
System.out.println("test() invoked");
}
}
どうしたの?