Hi,
I have an RMI application that can set the security policy file on the command line by
and within the application by
Everything works except when the <file> on command line doesn't exist, and the user is prompted a dialog box to enter the correct file name, then the application calls System.setProperty(). When this happens, it seems that the content of the correct policy file is not read, even System.setProperty() call is successful.
The following is the exception I get. Does anybody know what happen? How to fix it?
Thank you very much.
Exception in
thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
at java.security.AccessController.checkPermission(AccessController.java:394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1039)
at java.net.Socket.<init>(Socket.java:257)
at java.net.Socket.<init>(Socket.java:95)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:20)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:115)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:79)