2012-07-15 2 views
0

내가 자바 RMI와 클라이언트 - 서버 프로그램을 쓰고 있어요 내가 오류를 받고 있어요 거부 :자바 RMI java.security.AccessControlException : 액세스

java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve")

내 코드는 다음과 같습니다

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"); 
} 
} 

무엇이 잘못 되었나요?

답변

0

레지스트리를 추가하고 Serializable을 구현하는 것을 잊어 버렸습니다. 문제 해결됨. SecurityManager도 제거했습니다.

+0

다른 여러 가지를 잊어 버렸습니다. 이러한 누락으로 인해이 문제가 발생하지 않습니다. – EJP

+0

글쎄, 문제를 해결하는 사람들을 추가하기 때문에 잘못된 것입니다. – MikkoP

+0

그 문제를 해결할 수있는 유일한 방법은 SecurityManager를 제거하거나 .policy 파일을 수정하는 것입니다. – EJP

0

SecurityManager를 설치했지만이 코드를 실행할 수있는 충분한 권한을 부여하지 않았습니다.

왜 SecurityManager가 필요하다고 생각하십니까? 업로드 된 코드를 실행할 계획이 아니라면 그냥 제거 할 것입니다.

관련 문제