Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.security.AccessControlException: access denied

843793Mar 2 2006 — edited May 11 2007
My RMI application is to let the client send an ArrayList of bean class (a set of getter/setter methods) to a remote server. Error occured as below:

java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.0.186:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1026)

1. AT SERVER SIDE (using j2sdk1.4.2_10)
a) RemoteDeliverSMSInterface.java
b) RemoteDeliverSMSImp.java

public static void main(String args[]){
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try{
RemoteDeliverSMSInterface rdsms = new RemoteDeliverSMSImp();
Naming.rebind("SMSsend",rdsms);
}catch(Exception e){
e.printStackTrace();
}
}

java -Djava.security.policy=c:\java.policy RemoteDeliverSMSImp

**java.policy
grant {
// Allow everything for now
permission java.security.AllPermission;
};

2. AT CLIENT SIDE (using j2sdk1.4.2_08)

a) Client.java

if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}

try{
RemoteDeliverSMSInterface service = (RemoteDeliverSMSInterface) Naming.lookup("rmi://192.168.0.186/SMSsend");
service.remoteDeliverSMS(smsBeanList);
}catch(Exception e){
e.printStackTrace();
}


Even though i already allow all access in policy, but the access denied still persisted? Any help would be appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2007
Added on Mar 2 2006
7 comments
835 views