Ask Experts Questions for FREE Help !
Ask
    javalola's Avatar
    javalola Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 17, 2012, 10:34 AM
    Java.security.AccessControlException: access denied
    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 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)
    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
    [email protected]

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


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 message 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 I've posted this in the wrong section do appologise.. what it is I've got a IOMEGA external hardrive that use to work fine with my old laptop who had windows xp on it. As I've just bought a new laptop recently with vista on it, I tried connecting the external...

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 permission to use this network resource . Contact the administrator of this server to...


View more questions Search