rmi 연결을 시도하고 있습니다. 나는 많은 보안 문제에 부딪 쳤지만이 모든 과거의 길을 찾을 수 없었습니다. 나는 내 jar 파일을 실행 :이 만들 사용하고RMI 연결이 거부되었습니다
java -Djava.security.policy=java.security.AllPermission -jar "myjarfile"
코드 것은 :
이public class server
{
public static void main(String args[])throws Exception
{
if (System.getSecurityManager() == null)
System.setSecurityManager (new RMISecurityManager() {
public void checkConnect (String host, int port) {}
public void checkConnect (String host, int port, Object context) {}
});
try
{
sampleserverimpl server = new sampleserverimpl();
System.out.println("SERVER IS WAITING");
LocateRegistry.createRegistry(2020);
//Runtime.getRuntime().exec("rmiregistry 2020");
Naming.rebind("//localhost:2020/SERVER", server);
}
catch(Exception e)
{
System.out.println(e);
}
}
};
내가 수신하고 오류 추적은 다음과 같습니다
Exception in thread "RMI TCP Connection(idle)" java.security.AccessControlExcept
ion: access denied (java.net.SocketPermission 127.0.0.1:31199 accept,resolve)jav
a.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
나는 시도 이 문제를 해결할 수있는 다양한 방법, 여기 누가 문제를 볼 수 있습니까?
감사합니다.
지금 실행, 감사합니다. 파일을 일찍 시도했지만 보안 관리자에 추가하지 않았습니다. +1 – chrissygormley