June 4th, 2003, 12:54 AM
Join Date: Jun 2003
Time spent in forums: < 1 sec
Reputation Power: 0
PLEASE HELP!! - RMI Example
I will firstly describe how my RMI example works fine WITHOUT a Security Manager. Then I will describe the problems when running WITH a Security Manager
WITHOUT A SECURITY MANAGER
The following files are included in directory C:\A\B\C\bank on machine C1
ASBBank.class (Remote object implementing BankInterface.class)
The following files are included in directory C:\D\E\F\bank on machine C2
Steps when run successfully without a security manager
1) Set classpath to c:\A\B\C
2) Go to c:\A\B\C
3) Type command: start rmiregistry 2010
4) Start server by: java bank.ATMServer C1:2010
1) Set classpath to c:\D\E\F
2) Go to c:\D\E\F
3) Type command: java bank.ATMClient C1:2010
WITH A SECURITY MANAGER
When using a security policy file the following changes are made:-
1) ATMServer main method is changed to include following code:-
if(System.getSecurityManager() == null)
2) Create security policy file c:\security\java.policy as follows:-
permission java.net.SocketPermission "*:1024-65535", "connect,accept";
Steps when run unsuccessfully
1) Go to c:\A\B\C
2) Type command: start rmiregistry 2010
3) Start server by: java –Djava.security.policy=c:\security\java.policy bank.ATMServer C1:2010
4) Result: Error – java.security.AccessControlException: access denied (java.net.SocketPermission C1 resolve)
1)What am I doing wrong – how can I get the application to work?
2)Even if I got the server to work on C1, is it necessary to create a separate security policy for C2, as well as set a Security Manager in ATMClient similar to in ATMServer?
3)Could it be that other security policies (some also named java.policy) for other applications (such as WebLogic etc) on my machine are overriding my specific security policy file?
Any help would be very much appreciated, as I am getting very frustrated !