|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
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 BankInterface.class ASBBank.class (Remote object implementing BankInterface.class) ASBBank_Skel.class ASBBank_Stub.class ATMServer.class The following files are included in directory C:\D\E\F\bank on machine C2 BankInterface.class ASBBank_Skel.class ASBBank_Stub.class ATMClient.class Steps when run successfully without a security manager On C1 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 On C2 1) Set classpath to c:\D\E\F 2) Go to c:\D\E\F 3) Type command: java bank.ATMClient C1:2010 Program works!!! WITH A SECURITY MANAGER When using a security policy file the following changes are made:- On C1 1) ATMServer main method is changed to include following code:- if(System.getSecurityManager() == null) System.setSecurityManager(new RMISecurityManager()); 2) Create security policy file c:\security\java.policy as follows:- grant { permission java.net.SocketPermission "*:1024-65535", "connect,accept"; }; Steps when run unsuccessfully On C1 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) QUERIES: 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 ! |
|
#2
|
|||
|
|||
|
try
grant { permission java.net.SocketPermission "*:1024-65535", "connect,accept,resolve"; }; |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > PLEASE HELP!! - RMI Example |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|