• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.security. AccessControlException : access denied

 
chandana nannapaneni
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to use RMI. I have seen an example for running the java program.It says to use the below line at command prompt,


java -Djava.rmi.server.codebase
= file:/c:/home/compute.jar
-Djava.rmi.server.hostname = zaphod.east
-Djava.security.policy = server.policy
ComputeEngine

MY QUESTION IS:
What is server.policy?
Is it just a text file which contains some code like

grant{
permission java.security.AllPermission;
};

I have tried the sample program and I am getting the error as follows,
ComputeEngine exception:

java.security.
AccessControlException:
access denied (java.net.
SocketPermission
127.0.0.1:1099 connect,resolve)

ETC ETC


WHAT SHOULD I DO?IS IT THE CASE WITH THE SECURITY ISSUES?
 
Sergrey Page
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding answer to your question.
server.policy file defines who can access the class.


regarding to the error your firewall might be blocking you or the port might be binded to other application.

Type "netstat" in the command prompt you can get all the ports that are being used on you system. If that port is being used by other ,try running your application using another port.
 
Sergrey Page
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you copy server.policy file in the folder where your java files are?
It seems that you did not apply the policy correctly.

Not only an address bind this might because of the policy file also.

Try saving the file as server.policy with the following grants .

grant {
permission java.security.AllPermission;
};

This might help resolving the error.
 
chandana nannapaneni
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou. Your suggestions helped me.My code is working now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!