Ask Experts Questions for FREE Help !
Ask

java.security.AccessControlException: access denied

Asked Jul 17, 2012, 10:34 AM — 1 Answer
Hi, I am a beginner in java. I am trying to create a rmi client- database server application in java, but i am struggling. The client and the database server are to work well even if placed in different computers, that is in separate packages.
My server seems to be working fine, but when i run my client i keep on getting the error: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve").

I read on security policies recently and I don't really know how to work with it in netbeans. I read that i am to create a security policy file and place it in the server package and client package too. I did so, I created a txt file with my policy and placed a copy of it in my netbeans projects, inside the the server and client src file and in the package respectively. My policy looks as follows:
Code:
grant {
  permission java.security.AllPermission;
};

My server looks as follows:
Code:
package wildanimalsserver;
import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
/**
 *
 * @author CTI
 */
public class WildAnimalsServer {
 
    public WildAnimalsServer() {
    }
    public static void main(String [] args) {
        try {
            RMISecurityManager security = new RMISecurityManager();
            System.setSecurityManager(new RMISecurityManager());
            //Creating and getting the reference to the RMI registry
            Registry registry = LocateRegistry.createRegistry(1099);
             
            //Instantiating the object
            AnimalObject ao = new AnimalObject();
            //Registering the object
            registry.rebind("Animal", ao);
            System.out.println("Server ready...");
        } catch (Exception e) {
            System.out.println(e);
        }
    }
     
}

..and my client:
Code:
package wildanimalsclient;
import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
/**
 *
 * @author CTI
 */
public class WildAnimalsClient {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
    try {
            RMISecurityManager security = new RMISecurityManager();
            System.setSecurityManager(new RMISecurityManager());
            // Get reference to rmi registry server
            Registry registry = LocateRegistry.getRegistry(1099);
            // Looking up for the server object
            IRemoteAnimal ra = (IRemoteAnimal)registry.lookup("Animal");
            System.out.println("Client ready and responding...");
 
        } catch (Exception e) {
            System.out.println(e);
        }       
    }
}

My Server consists of:
Animal.java(entity class mapping to database)
IRemoteanimal.java(RMI application interface)
AnimalObject.java(Animal object to be distributed)
WildAnimalsServer.java(server application)
WildAnimalsDBmanager.java(manage connection to database)
AnimalRepository.java(provides crud operations)

and my client:
Animal.java(same as server)
IRemoteanimal.java(same as server)
WildAnimalsClient.java(client application calling RMI server)

1 Answer
Marconian's Avatar
Marconian Posts: 1, Reputation: 1
New Member
 
#2

Aug 27, 2012, 03:42 PM
Could you find the answer to your problem? I'm beginning to work with RMI and I'm facing the same problem: java.net.SocketPermission

Let me know if you find any solution.

Thanks,

Marcos Alves
marconian@gmail.com
Helpful

Not your question? Ask your question View similar questions

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Add your answer here.

Remove Text Formatting

Undo
Redo
 
Decrease Size
Increase Size
Bold
Italic
Underline
Align Left
Align Center
Align Right
Ordered List
Unordered List
Decrease Indent
Increase Indent
Insert Email Link
Wrap [QUOTE] tags around selected text
Wrap [CODE] tags around selected text
Wrap [HTML] tags around selected text
Wrap [PHP] tags around selected text
Wrap [YOUTUBE] tags around selected text
Notification Type:



Check out some similar questions!

Security access code required tob access the aPp store [ 1 Answers ]

Every thing on apps filled out right except security code on credit card. ISn! This the number on the back by signature line?

Access is denied [ 2 Answers ]

I have two computers in my house and am trying to get them networked. My first computer can access the second computer, but the second computer can not access the first. Instead, I get this message "\\(COMPUTER NAME)\shareddocs is not accessible. You might not have permission to use this network...

Access denied [ 1 Answers ]

This mesage is coming when I am trying to open a folder from a computer in a local area network. The operating system is vista home \\computer\folder is not accessible. You might not have permission to use this network resources. Server to find out if you have access permission. Access is...

Access is denied [ 1 Answers ]

Hi there I'm new to this site so if iv posted this in the wrong section do appologise.. What it is iv got a IOMEGA external hardrive that use to work fine with my old laptop who had windows xp on it. As iv just bought a new laptop recently with vista on it, I tried connecting the external hard...

Access is denied ? [ 2 Answers ]

There is still a problem when I want to access to my ibm computer through my emachine pc I can access it easily but when try to access my emachine through ibm it says emachine is not accessible. You might not have premission to use this network resource . Contact the administrator of this server...


View more Java questions Search