2015-05-30 1 views
0

Я нашел в Интернете ответ, но мне ничего не помогло. Я пытаюсь запустить сервер RMI, который я создал. в главном сервере у меня есть эта часть:java rmi - access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect, solve")

System.setSecurityManager(new RMISecurityManager()); 
... 
... 
... 
Naming.rebind("//localhost/ForumSite", obj); 

мой файл политики: сервер, политика (и ... ведет к папке) -

grant codeBase "file:C:/.../workspace//ForunServer/bin/" { 
    permission java.security.AllPermission; 
    permission java.net.SocketPermission "localhost:1099-", "listen, connect, resolve"; 

}; 

grant { 
permission java.lang.RuntimePermission "setSecurityManager"; 
    permission java.lang.RuntimePermission "createSecurityManager"; 
    permission java.lang.RuntimePermission "usePolicy"; 
    }; 

Я пытаюсь запустить ОС Windows, то я писал в другом consloe: javaw rmiregistry и в другой (из папки Bin):

java -Djava.security.manager -Djava.security.policy=server.policy ServerSideImp 

Я продолжаю получать сообщение об ошибке:

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

Я убедился, что файл политики находится в том же месте,

здесь результаты выполнения, когда я добавить -Djava.security.debug = доступ, отказ в RUN-

access: access allowed ("java.io.FilePermission" "C:\Users...\ForumServer\bin" "read") access: access allowed ("java.lang.RuntimePermission" "setSecurityManager") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.1") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.2") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.3") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.4") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.5") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.6") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.7") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.8") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.9") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.10") access: access allowed ("java.security.SecurityPermission" "getProperty.security.provider.11") access: access allowed ("java.lang.RuntimePermission" "accessClassInPackage.sun.security.provider") access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") access: access allowed ("java.util.PropertyPermission" "java.security.egd" "read") access: access allowed ("java.security.SecurityPermission" "getProperty.securerandom.source") access: access allowed ("java.security.SecurityPermission" "putProviderProperty.SUN") access: access allowed ("java.util.PropertyPermission" "*" "read,write") access: access allowed ("java.util.PropertyPermission" "os.arch" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.net") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\net.dll" "read") access: access allowed ("java.util.PropertyPermission" "java.net.preferIPv4Stack" "read") access: access allowed ("java.util.PropertyPermission" "java.net.preferIPv6Addresses" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.net") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\net.dll" "read") access: access allowed ("java.util.PropertyPermission" "impl.prefix" "read") access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") access: access allowed ("java.util.PropertyPermission" "sun.net.spi.nameservice.provider.1" "read") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.net.NetPermission" "getNetworkInformation") access: access allowed ("java.lang.RuntimePermission" "fileSystemProvider") access: access allowed ("java.util.PropertyPermission" "user.dir" "read") access: access allowed ("java.util.PropertyPermission" "os.version" "read") access: access allowed ("java.util.PropertyPermission" "sun.jnu.encoding" "read") access: access allowed ("java.util.PropertyPermission" "java.nio.file.spi.DefaultFileSystemProvider" "read") access: access allowed ("java.io.FilePermission" "C:\Users\URI\AppData\Local\Temp" "read") access: access allowed ("java.io.FilePermission" "C:\Users\URI\AppData\Local\Temp" "read") access: access allowed ("java.io.FilePermission" "C:\Users\URI\AppData\Local\Temp" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.net") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\net.dll" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.nio") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\nio.dll" "read") access: access allowed ("java.util.PropertyPermission" "sun.nio.fs.ensureAccurateMetadata" "read") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.randomIDs" "read") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.hostname" "read") access: access allowed ("java.security.SecurityPermission" "getProperty.networkaddress.cache.ttl") access: access allowed ("java.util.PropertyPermission" "sun.net.inetaddr.ttl" "read") access: access allowed ("java.security.SecurityPermission" "getProperty.networkaddress.cache.negative.ttl") access: access denied ("java.net.SocketPermission" "URI-PC" "resolve") java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at java.net.InetAddress.getLocalHost(Unknown Source) at sun.rmi.transport.tcp.TCPEndpoint.(Unknown Source) at sun.rmi.transport.LiveRef.(Unknown Source) at sun.rmi.transport.LiveRef.(Unknown Source) at sun.rmi.server.UnicastServerRef.(Unknown Source) at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source) at java.rmi.server.UnicastRemoteObject.(Unknown Source) at java.rmi.server.UnicastRemoteObject.(Unknown Source) at ServerSideImp.(ServerSideImp.java:18) at ServerSideImp.main(ServerSideImp.java:62) access: access allowed ("java.security.SecurityPermission" "getPolicy") access: access allowed ("java.io.FilePermission" "C:\Users...\ForumServer\bin" "read") access: domain that failed ProtectionDomain (file:/C:/Users/.../ForumServer/bin/) [email protected] [email protected] ( ("java.lang.RuntimePermission" "setSecurityManager") ("java.lang.RuntimePermission" "createSecurityManager") ("java.lang.RuntimePermission" "exitVM") ("java.lang.RuntimePermission" "usePolicy") ("java.lang.RuntimePermission" "stopThread") ("java.util.PropertyPermission" "java.specification.version" "read") ("java.util.PropertyPermission" "java.version" "read") ("java.util.PropertyPermission" "os.arch" "read") ("java.util.PropertyPermission" "java.specification.vendor" "read") ("java.util.PropertyPermission" "java.vm.specification.name" "read") ("java.util.PropertyPermission" "java.vm.vendor" "read") ("java.util.PropertyPermission" "path.separator" "read") ("java.util.PropertyPermission" "os.version" "read") ("java.util.PropertyPermission" "file.separator" "read") ("java.util.PropertyPermission" "line.separator" "read") ("java.util.PropertyPermission" "java.vm.specification.vendor" "read") ("java.util.PropertyPermission" "java.specification.name" "read") ("java.util.PropertyPermission" "java.vendor.url" "read") ("java.util.PropertyPermission" "java.vendor" "read") ("java.util.PropertyPermission" "java.vm.version" "read") ("java.util.PropertyPermission" "java.vm.name" "read") ("java.util.PropertyPermission" "java.vm.specification.version" "read") ("java.util.PropertyPermission" "os.name" "read") ("java.util.PropertyPermission" "java.class.version" "read") ("java.net.SocketPermission" "localhost:0" "listen,resolve") ("java.io.FilePermission" "\C:\Users...\ForumServer\bin-" "read"))

access: access allowed ("java.util.PropertyPermission" "java.rmi.server.useLocalHostName" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.logLevel" "read") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.logLevel" "read") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.maxConnectionThreads" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.threadKeepAliveTime" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.proxy.logLevel" "read") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.proxy.connectTimeout" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.proxy.eagerHttpFallback" "read") access: access allowed ("java.util.PropertyPermission" "http.proxyHost" "read") access: access allowed ("java.util.PropertyPermission" "proxyHost" "read") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.disableHttp" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.readTimeout" "read") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.hostname" "read") access: access allowed ("java.util.PropertyPermission" "sun.misc.ProxyGenerator.saveGeneratedFiles" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.dgc.server.gcInterval" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.net") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\net.dll" "read") access: access allowed ("java.util.PropertyPermission" "" "read,write") access: access allowed ("java.util.PropertyPermission" "" "read,write") access: access allowed ("java.util.PropertyPermission" "sun.net.useExclusiveBind" "read") access: access allowed ("java.net.SocketPermission" "localhost:0" "listen,resolve") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "getClassLoader") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.RuntimePermission" "setContextClassLoader") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.util.PropertyPermission" "sun.rmi.dgc.logLevel" "read") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.PropertyPermission" "java.rmi.dgc.leaseValue" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.dgc.checkInterval" "read") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.logging.LoggingPermission" "control") access: access allowed ("java.util.PropertyPermission" "sun.rmi.runtime.schedulerThreads" "read") access: access allowed ("java.lang.RuntimePermission" "sun.rmi.runtime.RuntimeUtil.getInstance") access: access allowed ("java.lang.RuntimePermission" "setContextClassLoader") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.hostname" "read") access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") access: access allowed ("java.lang.RuntimePermission" "setContextClassLoader") access: access allowed ("java.lang.RuntimePermission" "getClassLoader") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.RuntimePermission" "setContextClassLoader") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "modifyThreadGroup") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.RuntimePermission" "modifyThread") access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") access: access allowed ("java.util.PropertyPermission" "java.rmi.server.hostname" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.connectionTimeout" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.handshakeTimeout" "read") access: access allowed ("java.util.PropertyPermission" "sun.rmi.transport.tcp.responseTimeout" "read") access: access allowed ("java.lang.RuntimePermission" "sun.rmi.runtime.RuntimeUtil.getInstance") access: access allowed ("java.net.SocketPermission" "localhost" "resolve") access: access allowed ("java.util.PropertyPermission" "jdk.net.ephemeralPortRange.low" "read") access: access allowed ("java.lang.RuntimePermission" "loadLibrary.net") access: access allowed ("java.io.FilePermission" "C:\Program Files\Java\jre1.8.0_45\bin\net.dll" "read") access: access allowed ("java.util.PropertyPermission" "jdk.net.ephemeralPortRange.high" "read") access: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at java.rmi.Naming.rebind(Unknown Source) at ServerSideImp.main(ServerSideImp.java:63) access: access allowed ("java.security.SecurityPermission" "getPolicy") access: access allowed ("java.io.FilePermission" "C:\Users...\ForumServer\bin" "read") access: domain that failed ProtectionDomain (file:/C:/Users/.../ForumServer/bin/) [email protected] [email protected] ( ("java.lang.RuntimePermission" "setSecurityManager") ("java.lang.RuntimePermission" "createSecurityManager") ("java.lang.RuntimePermission" "exitVM") ("java.lang.RuntimePermission" "usePolicy") ("java.lang.RuntimePermission" "stopThread") ("java.util.PropertyPermission" "java.specification.version" "read") ("java.util.PropertyPermission" "java.version" "read") ("java.util.PropertyPermission" "os.arch" "read") ("java.util.PropertyPermission" "java.specification.vendor" "read") ("java.util.PropertyPermission" "java.vm.specification.name" "read") ("java.util.PropertyPermission" "java.vm.vendor" "read") ("java.util.PropertyPermission" "path.separator" "read") ("java.util.PropertyPermission" "os.version" "read") ("java.util.PropertyPermission" "file.separator" "read") ("java.util.PropertyPermission" "line.separator" "read") ("java.util.PropertyPermission" "java.vm.specification.vendor" "read") ("java.util.PropertyPermission" "java.specification.name" "read") ("java.util.PropertyPermission" "java.vendor.url" "read") ("java.util.PropertyPermission" "java.vendor" "read") ("java.util.PropertyPermission" "java.vm.version" "read") ("java.util.PropertyPermission" "java.vm.name" "read") ("java.util.PropertyPermission" "java.vm.specification.version" "read") ("java.util.PropertyPermission" "os.name" "read") ("java.util.PropertyPermission" "java.class.version" "read") ("java.net.SocketPermission" "localhost:0" "listen,resolve") ("java.io.FilePermission" "\C:\Users...\ForumServer\bin-" "read"))

access: access allowed ("java.lang.RuntimePermission" "exitVM.1")

, но я действительно не понимаю, что здесь происходит, любая помощь будет решена.

+1

* «Я застал сеть для ответа» * - Я задавался вопросом, откуда исходил этот жгучий запах :-) –

ответ

2

Удалить менеджера безопасности. Это не нужно для RMI, если вы не используете функцию кодовой базы RMI, которой вы не являетесь.

+0

Но это не точное решение проблемы OP. Кроме того, вы можете проверить его файл политики -> 'grant { разрешение java.lang.RuntimePermission" setSecurityManager "; разрешение java.lang.RuntimePermission "createSecurityManager"; разрешение java.lang.RuntimePermission "usePolicy"; }; ' –

+1

@shekharsuman Это будет делать, пока не появится настоящая вещь. Мы могли бы пройти через всю мегалигу '-Djava.security.debug = access, failure', и мы, несомненно, обнаружили бы, что его файл .policy не загружается или слишком загружен, но это почти бесполезно. Вам не нужно разрешение на 'setSecurityManager', если вы уже работаете под управлением безопасности, и в этом случае вы не можете установить еще один, так что я не вижу релевантности' setSecurityManager'. – EJP

+0

@EJP Я пытался запустить его только с помощью java и имени файла, по-прежнему той же ошибки. Нужно ли мне это делать по-другому? – boaz